Bug #1219
find shouldn't use FTW_CHDIR
0%
Description
It's usefulness is doubtful and leads to subtle problems with -acl (missing starting paths), as well as other extensions I'm thinking of.
Updated by Yuri Pankov over 9 years ago
Some numbers:
sirius:yuri:~$ time for i in `seq 1 10`; do /usr/bin/find src/illumos/illumos-gate/ > /dev/null; done real 0m31.085s user 0m2.289s sys 0m28.558s sirius:yuri:~$ time for i in `seq 1 10`; do ~/ws/local/usr/src/cmd/find/find src/illumos/illumos-gate/ > /dev/null; done real 0m34.175s user 0m2.319s sys 0m31.732s
Updated by Rich Lowe over 9 years ago
You'd need, at the very least, to be careful about:
- The behaviour of -exec (which you'd change if you didn't make
doexec()
chdir instead - The various symlink-following implications if any (see also, the various trickery done in rm to try to avoid people fooling it, presuming that this is also necessary for find).
Updated by Yuri Pankov over 9 years ago
-exec explicitly disables FTW_CHDIR
case EXEC: case OK: walkflags &= ~FTW_CHDIR;
cmd/find/find.c, near line 559, and I hope -exec doesn't change the symlinks handling...
Updated by Rich Lowe over 9 years ago
The comments about exec and symlinks were separate.
My concern with links is whether it would in any way affect when and where find is willing to chase a link. I don't think it will, but we should check.
Updated by Yuri Pankov over 9 years ago
Rich Lowe wrote:
The comments about exec and symlinks were separate.
They aren't so separate as you meant them to be, as -exec disables FTW_CHDIR, and I don't think -exec changing behaviour of symlinks handling would be accepted (trying to rephrase my reply...).
My concern with links is whether it would in any way affect when and where find is willing to chase a link. I don't think it will, but we should check.
Ok.