findutils-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Findutils-patches] Re: [PATCH] Fix Savannah bug #30777.


From: Eric Blake
Subject: [Findutils-patches] Re: [PATCH] Fix Savannah bug #30777.
Date: Mon, 16 Aug 2010 08:23:28 -0600
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.7) Gecko/20100720 Fedora/3.1.1-1.fc13 Lightning/1.0b2pre Mnenhy/0.8.3 Thunderbird/3.1.1

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   address@hidden    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]