Bug 244561 - find -depth skips unreadable directories
Summary: find -depth skips unreadable directories
Status: Open
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-bugs (Nobody)
Depends on:
Reported: 2020-03-02 20:18 UTC by Tavian Barnes
Modified: 2020-10-29 08:22 UTC (History)
1 user (show)

See Also:

Patch for this issue (751 bytes, patch)
2020-03-02 20:18 UTC, Tavian Barnes
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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
find: foo: Permission denied

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

I think the attached patch should fix it.