Date: Fri, 05 Apr 2019 02:43:00 +0000 From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 237030] ls -R produces invalid output when recursing dot directories Message-ID: <bug-237030-227@https.bugs.freebsd.org/bugzilla/>
next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D237030 Bug ID: 237030 Summary: ls -R produces invalid output when recursing dot directories Product: Base System Version: 11.2-STABLE Hardware: Any OS: Any Status: New Severity: Affects Some People Priority: --- Component: bin Assignee: bugs@FreeBSD.org Reporter: parakleta@darkreality.org Created attachment 203394 --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D203394&action= =3Dedit Patch to skip recursion of dot directories `ls -R` doesn't print dot directories (i.e. those with a '.' prefix) nor th= eir contents but it still recurses through them and will print the contents of directories within. The standard could be argued as ambiguous on this point (see bug #206192), = but generally the agreement is that this is the wrong behaviour. Note addition= ally that FreeBSD doesn't exhibit either of the described behaviours because it doesn't print the contents of a dot directory, only the contents of non-dot-directories contained in dot-directories. As an example set up a directory as follows: `mkdir test; cd test; git init` Then `ls -R` outputs the following: <--> applypatch-msg.sample* pre-applypatch.sample* pre-rebase.sample= *=20=20=20 update.sample* commit-msg.sample* pre-commit.sample* pre-receive.sampl= e* post-update.sample* pre-push.sample*=20=20=20=20=20=20=20=20=20= =20 prepare-commit-msg.sample* ./.git/info: exclude ./.git/objects: info/ pack/ ./.git/objects/info: ./.git/objects/pack: ./.git/refs: heads/ tags/ ./.git/refs/heads: ./.git/refs/tags: <--> Now run `touch file; ls -R` and the result changes as follows: <--> file ./.git/branches: ./.git/hooks: applypatch-msg.sample* pre-applypatch.sample* pre-rebase.sample= *=20=20=20 update.sample* commit-msg.sample* pre-commit.sample* pre-receive.sampl= e* post-update.sample* pre-push.sample*=20=20=20=20=20=20=20=20=20= =20 prepare-commit-msg.sample* ./.git/info: exclude ./.git/objects: info/ pack/ ./.git/objects/info: ./.git/objects/pack: ./.git/refs: heads/ tags/ ./.git/refs/heads: ./.git/refs/tags: <--> Notice the extra directories that are now output that weren't before. The solution is quite simple, to just skip the recursion in the event that = the directory's children are skipped, and attached is a patch which does just t= hat. --=20 You are receiving this mail because: You are the assignee for the bug.=
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-237030-227>