[Bug 206192] ls -R warns about EACCES on directories it's not going to list anyway

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Wed Jan 13 11:03:04 UTC 2016


            Bug ID: 206192
           Summary: ls -R warns about EACCES on directories it's not going
                    to list anyway
           Product: Base System
           Version: 10.2-RELEASE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: bin
          Assignee: freebsd-bugs at FreeBSD.org
          Reporter: fuz at fuz.su

The FreeBSD implementation of ls -R decides to omit directories from recursive
listing which are omitted from listing anyway. This may be in violation of
POSIX [1] but that's irrelevant for this bug report. When ls -R encounters a
directory without reading permission, it outputs the resulting EACCES. This
even happens for directories which are never listed by ls -R anyway due to
their names beginning with a dot, which causes ls to output spurious warnings.
To reproduce, in an empty directory do:

    mkdir .a
    chmod a-r .a
    ls -R .

The following output results:

    $ ls -R . 
    ls: ./.a: Permission denied

If .a was readable, ls -R would not list it either, so the error message seems

[1]: http://austingroupbugs.net/view.php?id=1023

You are receiving this mail because:
You are the assignee for the bug.

More information about the freebsd-bugs mailing list