From a suggestion by Askar Safin in:
https://lists.gnu.org/r/bug-gnulib/2020-04/msg00074.html
* lib/fts.c (fts_build): If file types are known, optimize
FTS_LOGICAL+FTS_NOSTAT for non-symlinks and non-directories the
same way that we already optimize FTS_PHYSICAL+FTS_NOSTAT for
non-directories.
+2020-04-25 Paul Eggert <eggert@cs.ucla.edu>
+
+ Tune fts for FTS_LOGICAL+FTS_NOSTAT
+ From a suggestion by Askar Safin in:
+ https://lists.gnu.org/r/bug-gnulib/2020-04/msg00074.html
+ * lib/fts.c (fts_build): If file types are known, optimize
+ FTS_LOGICAL+FTS_NOSTAT for non-symlinks and non-directories the
+ same way that we already optimize FTS_PHYSICAL+FTS_NOSTAT for
+ non-directories.
+
2020-04-19 Bruno Haible <bruno@clisp.org>
vasnprintf: Add support for printing wide characters using escapes.
inode numbers. Some day we might optimize that
away, too, for directories where d_ino is known to
be valid. */
- bool skip_stat = (ISSET(FTS_PHYSICAL)
- && ISSET(FTS_NOSTAT)
+ bool skip_stat = (ISSET(FTS_NOSTAT)
&& DT_IS_KNOWN(dp)
- && ! DT_MUST_BE(dp, DT_DIR));
+ && ! DT_MUST_BE(dp, DT_DIR)
+ && (ISSET(FTS_PHYSICAL)
+ || ! DT_MUST_BE(dp, DT_LNK)));
p->fts_info = FTS_NSOK;
/* Propagate dirent.d_type information back
to caller, when possible. */