Project

General

Profile

Bug #1219

find shouldn't use FTW_CHDIR

Added by Yuri Pankov about 8 years ago. Updated about 8 years ago.

Status:
New
Priority:
Low
Assignee:
-
Category:
cmd - userland programs
Start date:
2011-07-15
Due date:
% Done:

0%

Estimated time:
Difficulty:
Bite-size
Tags:
needs-triage

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.

History

#1

Updated by Yuri Pankov about 8 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

#2

Updated by Rich Lowe about 8 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).
#3

Updated by Yuri Pankov about 8 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...

#4

Updated by Rich Lowe about 8 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.

#5

Updated by Yuri Pankov about 8 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.

Also available in: Atom PDF