Strange `find` syntax error in crosstool-ng
Dave Korn
dave.korn@artimi.com
Tue Jan 29 18:10:00 GMT 2008
On 28 January 2008 11:00, Michael Abbott wrote:
> On Mon, 28 Jan 2008, Michael Abbott wrote:
>> My crosstool build fails with the message
>> [38:16] / find: missing argument to `-exec'
> ...
>> find ... -name ... -exec rm -fv {} \+ ...
>> Eh? How on earth did \; become transformed into \+?
>>
>> The attached patch should fix this, but I haven't tested it yet.
>
> Tested, and builds just fine now, which really begs the question: where
> did \+ come from? According to svn those `find ... -exec rm ...` lines
> have always ended in \+ since they were introduced in revision 158 ...
> which implies that either your find accepts + as an alias for ;
> (implausible) or those lines never got exercised (also implausible).
What version of find do you have running? I have
/artimi/software/firmware $ find --version
GNU find version 4.3.2
Features enabled: O_NOFOLLOW(enabled) LEAF_OPTIMISATION FTS CBO(level=0)
And in the info page I have:
8.1.4 Going back to -exec
-------------------------
There is indeed a more universal mechanism, which is a slight
modification to the `-exec' action. The normal `-exec' action assumes
that the command to run is terminated with a semicolon (the semicolon
normally has to be quoted in order to protect it from interpretation as
the shell command separator). The SVR4 edition of Unix introduced a
slight variation, which involves terminating the command with `+'
instead:
find /var/tmp/stuff -mtime +90 -exec /bin/rm {} \+
The above use of `-exec' causes `find' to build up a long command
line and then issue it. This can be less efficient than some uses of
`xargs'; for example `xargs' allows new command lines to be built up
while the previous command is still executing, and allows you to
specify a number of commands to run in parallel. However, the `find
... -exec ... +' construct has the advantage of wide portability. GNU
findutils did not support `-exec ... +' until version 4.2.12; one of
the reasons for this is that it already had the `-print0' action in any
case.
cheers,
DaveK
--
Can't think of a witty .sigline today....
--
For unsubscribe information see http://sourceware.org/lists.html#faq
More information about the crossgcc
mailing list