FTSENT: name and path on `/' versus name and path on `*/'

Matthew Story matthewstory at gmail.com
Thu Mar 15 20:46:04 UTC 2012


Found a curious incongruent behavior in fts(3), wondering if there is some
reason for this, or if it's just a bug. If you include the path

`/'

the FTSENT at depth 0 that is returned for the path has both fts_path = "/"
and fts_name = "/", compared to other entries, like /var which has fts_path
= "/" and fts_path = "/" and fts_name = "var", or /var/, which has fts_path
= "/var/" and fts_name = "".

Given the behavior of other paths used in fts(3), my expectation here is
that FTSENT for path "/" on depth 0 would have fts_path = "/" and fts_name
= "".  Haven't delved down into the code enough to figure out where this is
happening, but from a cursory read through libc/gen/fts.c there doesn't
seem to be any explicit special casing of the path "/".

Can anyone shed light on why this behavior is desirable, or if it's just a
bug I'm happy to file a PR and delve further into fts.c ...

-- 
regards,
matt


More information about the freebsd-hackers mailing list