[PATCH v5 2/2] io: Use gnulib fts implementation (BZ 22944, BZ 20331)
Paul Eggert
eggert@cs.ucla.edu
Wed Apr 15 21:56:30 GMT 2026
On 2026-04-13 09:15, Collin Funk wrote:
> Also worth noting that if dracut only needs the file type it can
> continue to use FTS_NOSTAT. In the Gnulib implementation
> fts_statp->st_mode will be set to a file type based on the d_type from
> readdir or set to 0 if unknown.
Yes, but that should be documented, otherwise callers can't rely on it.
glibc document this stuff in in the public include headers, and these
headers need better comments.
I noticed that Gnulib's fts.h documents this behavior for the new
FTS_DEFER_STAT flag, but not for the existing FTS_NOSTAT flag that you
mentioned, so I installed the attached patches into Gnulib. The first
patch fixes FTS_DEFER_STAT to behave as per documentation even for roots
after the first one (this matters for unlikely situations where the
comparison function looks at a later root's file type); the second fixes
the documentation to say that FTS_STAT acts like FTS_DEFER_STAT in the
situation you're describing.
I think these patches should be propagated into glibc.
cc'ing bug-gnulib since it's a Gnulib change.
PS. This stuff should also be documented in the glibc manual, but that's
a bigger change that we can do at our convenience.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-fts-match-doc-for-FTS_DEFER_STAT-mode.patch
Type: text/x-patch
Size: 1428 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/libc-alpha/attachments/20260415/7cbf1c1d/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-doc-doc-FTS_NOSTAT-similarity-to-FTS_DEFER_STAT.patch
Type: text/x-patch
Size: 2810 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/libc-alpha/attachments/20260415/7cbf1c1d/attachment-0001.bin>
More information about the Libc-alpha
mailing list