Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 27 Mar 2005 23:18:31 +0200
From:      Jilles Tjoelker <jilles@stack.nl>
To:        freebsd-hackers@freebsd.org
Subject:   find -exec {} + fails with -or and ! (bin/79263)
Message-ID:  <20050327211831.GD6814@stack.nl>

next in thread | raw e-mail | index | archive | help
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@jaguar /home/jilles/tmp% find find \! -exec echo {} +

(no output)

jilles@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@jaguar /home/jilles/src/svn/hyperion% find . \( -name .svn -prune \) -o -type f -exec grep -i silence /dev/null {} +

(no output)

jilles@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@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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050327211831.GD6814>