bugfindutils - Bugs: bug #36452, xargs needs "-I" (eye)...

 
 

bug #36452: xargs needs "-I" (eye) last ...

Submitter:  Kevin <dalecosp>
Submitted:  Fri 11 May 2012 05:16:28 PM UTC
   
 
Category:  xargs Severity:  3 - Normal
Item Group:  Wrong result Status:  Invalid
Privacy:  Public Assigned to:  jay
Originator Name:  Open/Closed:  Closed
Release:  4.4.2 Fixed Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Fri 11 May 2012 07:47:09 PM UTC, comment #2: 

Thanks for the clue-stick, Eric.  Looking for "close".  I probably don't have that option, eh?


Kevin <dalecosp>
Fri 11 May 2012 05:21:38 PM UTC, comment #1: 

POSIX states that mixing -I and -L is not portable:

http://pubs.opengroup.org/onlinepubs/9699919799/utilities/xargs.html

You are using a non-portable command line, and so it should come as no surprise that BSD and GNU xargs differ in behavior.

That said, you are not the first to request having -I and -L work together, and presumably with semantics similar to BSD, or even at a bare minimum to error out instead of silently changing behavior depending on argument ordering; but no one has bothered to write and submit such a patch.

Eric Blake <ericb>
Group administrator
Fri 11 May 2012 05:16:28 PM UTC, original submission:  

I ran an xargs(1) command in the BSD implementation with success and posted the result at [url=http://board.phpbuilder.com/board/showthread.php?t=10384409  PHPBuilder].  Lo & behold, it didn't work in a seven-year old version of GNU xargs(1) ... unless we changed the invocation to put "-I" last, before argument.

On GNU IRC's #gnu, user leo_rockway tested with findutils version 4.4.2, which appears to be the latest available on most(?) public [url=http://ftp.gnu.org/pub/gnu/findutils/ FTP sites].

To recap, this works in a non-GNU xargs(1) implementation:


find . -type f -print0 | xargs -I {} -0 -L 1 convert -compress JPEG -quality 75 {} {}


However, with GNU xargs(1) <=4.4.2, this results in convert complaining:

unable to open image `{}': @ error/blob.c/OpenBlob/2489.
missing an image filename `./gnu+linux.png' @ error/convert.c/ConvertImageCommand/2940.


Changing the invocation of GNU xargs(1) to this:

find . -type f -print0 | xargs -0 -L 1 -I {} convert -compress JPEG -quality 75 {} {}


Allows convert to function normally and complete the command (i.e. it gets the correct arguments).  The only difference seems to be the location of the "-I" parameter.

I do apologize if this has been fixed since 4.4.2 --- I see that several other 'releases' seem to be in the Fixed Release selector, but, as I mentioned, I don't see them on the public FTP sites.  I'm a bit of a "newb" where GNU/Linux are concerned, having spent years with the BSD family of OSen.  Thanks for your time and contributions.

Kevin <dalecosp>

 

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

Attach Files:
   
   
Comment:
   

No files currently attached

 

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 ericb (Posted a comment)
  • -email is unavailable- added by dalecosp (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 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2013-09-25 jay StatusNone Invalid
        Assigned toNone jay
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code