Bug 244561

Summary: find -depth skips unreadable directories
Product: Base System Reporter: Tavian Barnes <tavianator>
Component: binAssignee: freebsd-bugs (Nobody) <bugs>
Status: Open ---    
Severity: Affects Only Me CC: lwhsu
Priority: ---    
Version: CURRENT   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
Patch for this issue none

Description Tavian Barnes 2020-03-02 20:18:40 UTC
Created attachment 212103 [details]
Patch for this issue

find -depth skips unreadable directories, while find without -depth prints it.  For example:

$ mkdir -p foo/bar
$ chmod -r foo
$ find foo -depth
find: foo: Permission denied
$ find foo
foo
find: foo: Permission denied

GNU find had the same bug: https://savannah.gnu.org/bugs/?54171

I think the attached patch should fix it.