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

 
 

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

Submitter:  Mike Frysinger <vapier>
Submitted:  Sun 15 Aug 2010 05:11:56 AM UTC
   
 
Category:  find Severity:  4 - Important
Item Group:  Wrong result Status:  Fixed
Privacy:  Public Assigned to:  jay
Originator Name:  Open/Closed:  Closed
Release:  4.5.9 Fixed Release:  4.5.10
* Mandatory Fields

Add a New Comment Rich Markup
   

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>
Group administrator
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>
Group administrator
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 Files:
   
   
Comment:
   

Attached Files

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by jay (Updated the item)
  • -email is unavailable- added by vapier (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 9 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2011-05-11 jay Open/ClosedOpen Closed
        Fixed ReleaseNone 4.5.10
    2010-08-15 jay StatusCode Review Fixed
    2010-08-15 jay Attached File- Added 0001-Fix-Savannah-bug-30777.patch, #21229
    2010-08-15 jay StatusIn Progress Code Review
    2010-08-15 jay Attached File- Added 0001-Fix-Savannah-bug-30777.patch, #21223
    2010-08-15 jay Severity3 - Normal 4 - Important
        StatusNone In Progress
        Assigned toNone jay

    Back to the top

    Powered by Savane 3.13-4448.
    Corresponding source code