On 08/15/2010 05:53 AM, James Youngman wrote:
>  
> +#30777: find -exec echo TURNIP{} \+ is accepted but TURNIP is eaten

LOL.  I admit that I love the dry humor present in open source projects!

POSIX says, for -exec ... +:

"If a utility_name or argument string contains the two characters "{}",
but not just the two characters "{}" , it is implementation-defined
whether find replaces those two characters or uses the string without
change."

Implementation-defined is a bear - it means we have to pick one of those
two behaviors, and document it; we are not allowed to pick an alternate
third behavior (rejecting with an error message).  Contrast this with
the statement:

"If more than one argument containing only the two characters "{}" is
present, the behavior is unspecified."

Which means that '-exec {} {} +' can do whatever we want.  At any rate,
I think the end result is that I don't think this patch quite meets with
POSIX.  But I think that a patch to do:

find . -exec TURNIP{} +

output exactly "TURNIP{}" for each file found meets the POSIX spec,
provided we document that; and is not much harder to do than this
proposed patch of erroring out when we discover the existence of
"TURNIP{}" in the argument list.  And if POSIXLY_CORRECT is not set, I
don't see any harm in also issuing a warning (but not an error that
changes exit status, and nothing when in POSIXLY_CORRECT mode).

-- 
Eric Blake   [email protected]    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to