bugfindutils - Bugs: bug #30777, using "-exec {} +"...

 
 

bug #30777: using "-exec {} +" syntax silently gobbles excess strings

Submitted by:  Mike Frysinger <vapier>
Submitted on:  Sun 15 Aug 2010 05:11:56 AM UTC  
 
Category: findSeverity: 4 - Important
Item Group: Wrong resultStatus: Fixed
Privacy: PublicAssigned to: James Youngman <jay>
Originator Name: Open/Closed: Closed
Release: 4.5.9Fixed Release: 4.5.10

Add a New Comment(Rich Markup)
   

You are not logged in

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

 

Sun 15 Aug 2010 11:38:35 PM UTC, comment #3:

I've attached an updated patch (which I'm gong to push) which quotes the arguments.

(file #21229)

James Youngman <jay>
Project AdministratorIn charge of this item.
Sun 15 Aug 2010 04:00:59 PM UTC, comment #2:

that seems to work ... should the error message be quoted at all though ? all the symbols seem to meld into the surrounding text.

In '-exec ... {} +' the '{}' must appear by itself, but you specified '/usr/{}'

Mike Frysinger <vapier>
Sun 15 Aug 2010 11:52:36 AM UTC, comment #1:

I believe the attached patch (against c530d90990ca81dfca254bbca18ab9e7273b4585) fixes the bug.

(file #21223)

James Youngman <jay>
Project AdministratorIn charge of this item.
Sun 15 Aug 2010 05:11:56 AM UTC, original submission:

setup:
mkdir foo
cd foo
touch a b c

then run:
find -type f -exec echo /usr/{} \;
and get back:
/usr/./a /usr/./b /usr/./c

now change the \; to a +:
find -type f -exec echo /usr/{} +
and you get back the odd output:
./a ./b ./c

personally, i think treating it a bit more intelligently and getting the same output as in the first `find` would be nice, but if you dont want to support that, `find` at least should be issuing a warning/error here.

otherwise something innocent like:
# use current file list to delete files in another dir
find . -type f -exec rm /some/other/path/{} \;
can easily & silently turn foul when doing:
find . -type f -exec rm /some/other/path/{} +
all the files in $PWD get deleted instead of /some/other/path/

tested with version 4.4.2, 4.5.8, and current git (c530d90990ca81dfca254bbca18ab9e7273b4585) -- same behavior

Mike Frysinger <vapier>

 

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

Attach File(s):
   
   
Comment:
   

Attached Files

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by jay (Updated the item)
  • -unavailable- added by vapier (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 9 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Wed 11 May 2011 09:38:49 AM UTCjayOpen/ClosedOpen=>Closed
      Fixed ReleaseNone=>4.5.10
    Sun 15 Aug 2010 11:39:31 PM UTCjayStatusCode Review=>Fixed
    Sun 15 Aug 2010 11:38:35 PM UTCjayAttached File-=>Added 0001-Fix-Savannah-bug-30777.patch, #21229
    Sun 15 Aug 2010 03:48:02 PM UTCjayStatusIn Progress=>Code Review
    Sun 15 Aug 2010 11:52:36 AM UTCjayAttached File-=>Added 0001-Fix-Savannah-bug-30777.patch, #21223
    Sun 15 Aug 2010 11:37:38 AM UTCjaySeverity3 - Normal=>4 - Important
      StatusNone=>In Progress
      Assigned toNone=>jay

    Back to the top


    Powered by Savane 3.1-cleanup1