bug-findutils
[Top][All Lists]
Advanced

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

Re: find . -exec TURNIP{} +


From: Geoff Clare
Subject: Re: find . -exec TURNIP{} +
Date: Thu, 21 Oct 2010 16:12:10 +0100
User-agent: Mutt/1.5.18 (2008-05-17)

James Youngman <address@hidden> wrote, on 21 Oct 2010:
>
> On Wed, Sep 15, 2010 at 10:32 AM, Geoff Clare <address@hidden> wrote:
> > I wrote, on 04 Sep 2010:
> >>
> >> Eric Blake <address@hidden> wrote, on 03 Sep 2010:
> >> >
> >> > However, it also means that we have to think about this case:
> >> >
> >> > find . -exec TURNIP{} {} +
> >
> >> Perhaps we should raise this on the Austin Group mailing list.
> >
> > I have submitted it as bug 309.
> 
> I notice that the bug now has a response too:
> http://austingroupbugs.net/view.php?id=309
> 
> As far as I understand note 562 attached to that bug (I have a copy of
> draft 5.1, but the line numbers do not seem to correspond, so I'll
> need to check for an updated version):

If you are a member of the austin-group-l mailing list, I think you
should be able to download the final SUSv4 PDF from
http://www.opengroup.org/pubs/catalog/c082.htm
(I'm assuming when that page says "members" it means Austin Group
members.)

> 1. If "{}" occurs more than once in the arguments to -exec, the
> behaviour is unspecified.
> 2. If "{}" occurs in an argument but the argument is not exactly "{}",
> there are two options:
>  a. The argument is used, unchanged
>  b. The argument is substituted
> ... and we must document which will occur.  [I have a preference for 2a]

Item 2 only applies to the ';' terminator, and item 1 only applies to
the '+' terminator.

The end result of the changes in note 562 is that the requirements
for the ';' terminator are unchanged, and for the '+' terminator you
have more freedom to do whatever you want if more than one argument
contains "{}" (regardless of whether the extra one(s) are only "{}").

If you do a substitution for TURNIP{} when the terminator is ';' you
might decide that leaving it unchanged for a '+' terminator would
be undesirable as it would mean find silently treats such arguments
differently for the two terminators.  You could instead report an
error when the terminator is '+'.  Or you could do a substitution -
there is one that sort of makes sense, namely prefix TURNIP to every
pathname as you aggregate them.

> Bug 310 is also relevant.  It deals with this question of how this
> should be interpreted:
> 
> find -exec utility1 arg arg2 arg4 arg5{} + -exec utility2 arg6 {} +
> 
> The options are
>  (i) utility1 is invoked with a number of arguments, one of which is
> utility2.   utility2 is not invoked by find.
>  (ii) utility1 and utility2 are both invoked.   The final argument
> passed to utility1 is either substituted or not, and this is
> implementation defined (as for note 562).
> However, as far as I can see there is no resolution yet for bug 310,
> so I don't know whether we should be implementing (i) or (ii).

Bug 310 is marked "Accepted" and "Resolved".  This means the requested
change was accepted as an editorial change, no formal interpretation
needed.  Option (ii) is not correct because the standard requires
that the first '+' is not treated as a terminator.  However, since
more than one argument contains "{}" you do have more choices than
just option (i), as discussed above.  E.g. you could report an error.

> Either way, the current implementation of GNU find at the current HEAD
> revision rejects the construct, which is wrong.

Not necessarily - it depends on what the error message is.  If the
message implies that the first '+' was treated as a terminator, then
it's wrong.

Regards,
Geoff.



reply via email to

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