Date: Mon, 2 Dec 2002 01:45:27 -0800 From: David Schultz <dschultz@uclink.Berkeley.EDU> To: Bruce Evans <bde@zeta.org.au> Cc: freebsd-bugs@FreeBSD.ORG Subject: Re: bin/45723: ls(1)'s wrong behaviour with not searchable directories Message-ID: <20021202094527.GA398@HAL9000.homeunix.com> In-Reply-To: <20021202182939.U3146-100000@gamplex.bde.org> References: <200212020600.gB2603ve035685@freefall.freebsd.org> <20021202182939.U3146-100000@gamplex.bde.org>
next in thread | previous in thread | raw e-mail | index | archive | help
Thus spake Bruce Evans <bde@zeta.org.au>: > On Sun, 1 Dec 2002, David Schultz wrote: > > > > >How-To-Repeat: > > > $ mkdir FOOBAR > > > $ cd FOOBAR > > > $ touch a b c d e > > > $ cd .. > > > $ chmod -x FOOBAR > > > $ ls FOOBAR > > > <no output, no errors> > > > > This one seems to be fixed in -CURRENT. > > It is broken for me, but that is because I have ls aliased to ls -F. Yes, -G, -F, -l---basically anything that requires ls to stat the files---will trigger the bug. > > The problem appears to be in the fts_children() implementation. > > If a chdir fails, the routine does not retry with FTS_NOCHDIR as > > it should... > > I think fts it must honor FTS_NOCHDIR. ls could retry. But chdir > is essential for handling deep directories. Most utilities that > use FTS_NOCHDIR are simply broken since they should or shall support > deep directories but don't. cp is the most important one. I'm not suggesting that it ignore FTS_NOCHDIR, but rather that it fall back to the FTS_NOCHDIR behavior when it lacks search permission. Deeply dested directories are a non-issue here (modulo one path component) because without search permission, you can't descend further into the heirarchy anyway. BTW, FTS already fails to honor (the lack of) FTS_NOCHDIR if you pass FTS_LOGICAL as a flag to fts_open(), and when it fails to open ".". If you fix the problem in ls, you'll also have to fix it in tcsh, maybe rm, and many other utilities. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20021202094527.GA398>