[bug #60207] -prune returns false for files for which fstatat() fails with EACCESS

Bernhard Voelker <[email protected]>
Newsgroups gmane.comp.gnu.findutils.bugs
Message-ID <[email protected]>
Follow-up Comment #2, bug #60207 (project findutils):

Thanks for the report.

Hmm, with '-D tree' we can see that -prune inserts a "[call stat] [need
type]".


$ find -D tree -name 'a*' -prune -o -print 2>&1 | sed -n '/^Optimized command
line/{n; s/ .est success rate [0-9.]*.//g; p}'
 ( -name a* -a [call stat] [need type] -prune  ) -o -print 


In parser.c, we see that -prune adds it unless -depth is set:

  if (options.do_dir_first == false)
    our_pred->need_stat = our_pred->need_type = false;


And indeed, adding -depth doesn't yield the extra "[call stat] [need type]".

find -D tree -depth -name 'a*' -prune -o -print 2>&1 | sed -n '/^Optimized
command line/{n; s/ .est success rate [0-9.]*.//g; p}'
 (  ( -depth -a -name a*  ) -a -prune  ) -o -print 


The condition has been added in commit
https://git.sv.gnu.org/cgit/findutils.git/commit/?id=d62aacb1b

The question is why?  It seems that this because -prune uses S_ISDIR()
stop at the current level ... have to investigate.

    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?60207>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.