diff --git a/NEWS b/NEWS index d63b6516..d7ef0d09 100644 --- a/NEWS +++ b/NEWS @@ -54,6 +54,10 @@ Some minor documentation improvements are listed in "Bug Fixes" below. ** Bug Fixes +#54171: 'find -depth' now outputs the name of unreadable directories. + Previously, FTS-based find missed to output those entries. + Bug present since the FTS implementation in FINDUTILS_4_3_0-1. + #52981: find: the '-delete' action no longer complains about disappeared files when the '-ignore_readdir_race' option is given, too. That action will also returns true in such a case now. diff --git a/find/ftsfind.c b/find/ftsfind.c index 0e2aca33..607ea8d3 100644 --- a/find/ftsfind.c +++ b/find/ftsfind.c @@ -342,12 +342,23 @@ consider_visiting (FTS *p, FTSENT *ent) statbuf.st_ino = ent->fts_statp->st_ino; /* Cope with various error conditions. */ - if (ent->fts_info == FTS_ERR - || ent->fts_info == FTS_DNR) + if (ent->fts_info == FTS_ERR) { nonfatal_target_file_error (ent->fts_errno, ent->fts_path); return; } + if (ent->fts_info == FTS_DNR) + { + nonfatal_target_file_error (ent->fts_errno, ent->fts_path); + if (options.do_dir_first) + { + /* Return for unreadable directories without -depth. + * With -depth, the directory itself has to be processed, yet the + * error message above has to be output. + */ + return; + } + } else if (ent->fts_info == FTS_DC) { issue_loop_warning (ent);