find -prune seems to not quite do what it says. At least, when delete
is used. Here's an example tree (on 7.0-RELEASE, amd64 build):

bhuda# ls -Rl /tmp/x
total 2
drwx------ 2 root wheel 512 Mar 24 01:01 y

total 2
-rw-r--r-- 1 root wheel 1111 Mar 24 01:01 motd

/tmp/x contains a subdirectory closed to everyone but root, which has
a file in it. No problem. Point find at it as a user:

bhuda% find /tmp/x -print
find: /tmp/x/y: Permission denied

As expected, it complains. Now let's use prune to trim the search - at
the root of the tree:

bhuda% find /tmp/x -prune

Hmm, it prints the root of the tree. That might be a bug; might
not. But we can fix it with a little tweak:

bhuda% find /tmp/x -prune -o -print

Making the print conditional on not pruning, and we always prune. Ok,
now let's look at what looks to me like a bug:

bhuda% find /tmp/x -prune -o -delete
find: /tmp/x/y: Permission denied

Why on earth (or off it) is find trying to look at /tmp/x? Am I
correct in assuming that this is a bug?

Mike Meyer
Independent Network/Unix/Perforce consultant, email for more information.
_______________________________________________ mailing list
To unsubscribe, send any mail to ""