Subject: Re: kern/28397: fdesc filesystems: directory causes a cycle
To: None <igor@string1.ciencias.uniovi.es>
From: None <cube@cubidou.net>
List: netbsd-bugs
Date: 11/23/2004 17:54:01
--lMM8JwqTlfDpEaS6
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Tue, Nov 23, 2004 at 04:40:00PM +0000, igor@string1.ciencias.uniovi.es w=
rote:
> >Number:         28397
> >Category:       kern
> >Synopsis:       fdesc filesystems: directory causes a cycle
> >Confidential:   no
> >Severity:       serious
> >Priority:       medium
> >Responsible:    kern-bug-people
> >State:          open
> >Class:          sw-bug
> >Submitter-Id:   net
> >Arrival-Date:   Tue Nov 23 16:40:00 +0000 2004
> >Originator:     Igor Sobrado
> >Release:        1.6.2
> >Organization:
> University of Oviedo
> >Environment:
> NetBSD localhost 1.6.2 NetBSD 1.6.2 (CPIR400GT) #0: Sun Jun 13 23:09:13 C=
EST 2004     sobrado@localhost:/usr/src/sys/arch/i386/compile/CPIR400GT i386
>=20
> >Description:
> Mounting a file-descriptor filesystem gives unexpected results.
> >How-To-Repeat:
[...]
> 3. some entries in this directory are not character devices:
>=20
> # ls -la
> total 0
> dr-xr-xr-x  2 root  wheel   512 Nov 23 15:51 .
> dr-xr-xr-x  2 root  wheel   512 Nov 23 15:51 ..
> crw-rw-rw-  1 root  wheel  5, 1 Nov 22 23:46 0
> crw-rw-rw-  1 root  wheel  5, 1 Nov 22 23:46 1
> crw-rw-rw-  1 root  wheel  5, 1 Nov 22 23:46 2
> dr--r--r--  2 root  wheel   512 Nov 23 15:51 3
> dr--r--r--  2 root  wheel   512 Nov 23 15:51 4
> dr--r--r--  2 root  wheel   512 Nov 23 15:51 5
>=20
> why???

Because 'ls -la' opens three files, thus /dev/fd for that process
contains those descriptors.  Those three files are actually all '.'.

I don't know why ls does that, it's not my point.  But the entries
you see for 3, 4 and 5 are really just '/dev/fd'.

> 4. recursively listing those entries produce the cycle errors:
>=20
> localhost# ls -lR
> total 0
> crw-rw-rw-  1 root  wheel  5, 1 Nov 22 23:46 0
> crw-rw-rw-  1 root  wheel  5, 1 Nov 22 23:46 1
> crw-rw-rw-  1 root  wheel  5, 1 Nov 22 23:46 2
> dr--r--r--  2 root  wheel   512 Nov 23 15:51 3
> dr--r--r--  2 root  wheel   512 Nov 23 15:51 4
> dr--r--r--  2 root  wheel   512 Nov 23 15:51 5
> ls: 3: directory causes a cycle
> ls: 4: directory causes a cycle
> ls: 5: directory causes a cycle

Logical, given 3, 4 and 5 are really '.'.

> 5. when not using the long format output in ls(1) all looks fine
> (of course, if we exclude that entries 3-5 are not devices):
>=20
> # ls -R
> 0 1 2 3 4 5

Well, maybe it doesn't recurse when it's '.'.

Maybe the difference between 'ls -Rl' and 'ls -R' is worth some
research but the rest looks perfectly fine to me.

At least, I can't see any bugs in fdesc file-system in what you're
showing.

--=20
Quentin Garnier - cube@cubidou.net - cube@NetBSD.org
"Commala-come-five! / Even when the shadows rise!
To see the world and walk the world / Makes ya glad to be alive."
Susannah's Song, The Dark Tower VI, Stephen King, 2004.

--lMM8JwqTlfDpEaS6
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (NetBSD)

iQEVAwUBQaNrKdgoQloHrPnoAQL73Qf/Xa9HnnZYAHhRIJaWsQggWq2kbw41wIdg
Ujv0onLDSOtN18K4q7Oll2xDAm55jwPSsJaCp8ygE6ErJxWcTWKfL2G5RULRjTKz
rJ96WgQsI7y1QLEDXVcs+KHtCYk96iGBbnDnAhbmwc85iJkiNCUF2GV94ElVumBH
LUXHf6SFQLy+8//HGCjo7iGmKMGxX33IuZyzc45p5JLSq0U8epS+sxcFQQkEv4S1
ZaUnvig0mKdf0hg0kYvGP6YyihXN9wPkH5Lg0nrtEx8suL7RAOFsGxXfzAIfyi0F
WydF82epDDc4EZD55009bGMXuz4mutUuWMYwZwXz9hoi3lARnbTJxQ==
=IiQG
-----END PGP SIGNATURE-----

--lMM8JwqTlfDpEaS6--