bugfindutils - Bugs: bug #26883, "or" condition and -exec...

 
 

bug #26883: "or" condition and -exec directive

Submitted by:  Dawid Marcin Grzesiak <dawidmarcin>
Submitted on:  Thu 25 Jun 2009 10:27:25 AM UTC  
 
Category: findSeverity: 3 - Normal
Item Group: Wrong resultStatus: Invalid
Privacy: PublicAssigned to: None
Originator Name: Open/Closed: Closed
Release: 4.4.0Fixed Release: None

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Thu 25 Jun 2009 06:59:05 PM UTC, comment #4:

Using tr and xargs -0 is not secure; in other words, it is the same as if you had done:

The whole point of 'xargs -0' is that it is only useful if you already had secure file names passed to xargs in the first place.

You probably want:

Eric Blake <ericb>
Project Administrator
Thu 25 Jun 2009 02:01:31 PM UTC, comment #3:

Oh yes, it works. Simple thing but quite confusing. Sorry about that.

Before you replay I temporary solved it using this approach:

I tried -print0 option, but as you mention, it takes precedence before -or operator.

Thanks,
Dawid

Dawid Marcin Grzesiak <dawidmarcin>
Thu 25 Jun 2009 12:06:20 PM UTC, comment #2:

In reading the email sent from the last comment, it looks like savannah interpreted what it thought was markup in my sample command line (plus I had a typo). Here's another try, this time with what I hope is the appropriate markup to capture it as literal text. You meant to type:

Eric Blake <ericb>
Project Administrator
Thu 25 Jun 2009 11:58:29 AM UTC, comment #1:

Not a bug.

find -name '.txt' -o -name '.dat'

is equivalent to:

find \( -name '.txt' -o -name '.dat' \) -print

Your second example:

find -name '.txt' -o -name '.dat' -exec echo {} \;

is equivalent to:

find -name '.txt' -o \( -name '.dat' -a -exec echo {} \; \)

In short, -a binds tighter than -o, and putting two operators side-by-side is equivalent to using -a between them. You meant to type:

find \( -name '.txt' -o -name '.dat' -\) -exec echo {} \;

Eric Blake <ericb>
Project Administrator
Thu 25 Jun 2009 10:27:25 AM UTC, original submission:

See this bug:

For the second invocation, the output should be exactly the same as for the first one.

Kind regards,
Dawid,
http://www.dmg.pl/

Dawid Marcin Grzesiak <dawidmarcin>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by ericb (Posted a comment)
  • -unavailable- added by dawidmarcin (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 2 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Thu 25 Jun 2009 11:58:29 AM UTCericbStatusNone=>Invalid
      Open/ClosedOpen=>Closed

    Back to the top


    Powered by Savane 3.1-cleanup1