find -exec {} + fails with -or and ! (bin/79263)

Jilles Tjoelker jilles at stack.nl
Sun Mar 27 13:18:33 PST 2005


The current implementation of the final (possibly only) execution of
find -exec {} + is incomplete and only works if the -exec is on the top
level of (implicitly) -and'ed primaries, not if it is behind -or or !. I
have a patch for this in PR bin/79263.

Examples (copied from PR):

Simple not-so-practical example (/home/jilles/tmp/find is the patched version
of /usr/src/usr.bin/find):

jilles at jaguar /home/jilles/tmp% find find \! -exec echo {} +

(no output)

jilles at jaguar /home/jilles/tmp% find/find find \! -exec echo {} +
find find/option.c find/extern.h find/find.1 find/find.c find/find.h find/function.c find/getdate.y find/ls.c find/main.c find/misc.c find/operator.c find/Makefile find/find.o find/function.o find/ls.o find/main.o find/misc.o find/operator.o find/option.o find/getdate.c find/getdate.o find/find find/find.1.gz

(expected output)

Practical example (searching through a Subversion checkout):

jilles at jaguar /home/jilles/src/svn/hyperion% find . \( -name .svn -prune \) -o -type f -exec grep -i silence /dev/null {} +

(no output)

jilles at jaguar /home/jilles/src/svn/hyperion% ~/tmp/find/find . \( -name .svn -prune \) -o -type f -exec grep -i silence /dev/null {} +

(expected output, snipped here)

In comparison:

jilles at jaguar /home/jilles/src/svn/hyperion% find . \( -name .svn -prune \) -o -type f -print0 | xargs -0 grep -i silence /dev/null

gives the expected output, even without the patch.

-- 
Jilles Tjoelker


More information about the freebsd-hackers mailing list