bugfindutils - Bugs: bug #58156, Order of xargs -L and -I flags...

 
 

bug #58156: Order of xargs -L and -I flags matters

Submitter:  David Hoese <djhoese>
Submitted:  Fri 10 Apr 2020 04:12:17 PM UTC
   
 
Category:  xargs Severity:  3 - Normal
Item Group:  Wrong result Status:  Duplicate
Privacy:  Public Assigned to:  berny
Originator Name:  Open/Closed:  Open
Release:  4.5.11 Fixed Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Mon 04 Jan 2021 11:28:37 PM UTC, comment #1: 

Marking this as a duplicate of
https://savannah.gnu.org/bugs/?52137

Bernhard Voelker <berny>
Group administrator
Fri 10 Apr 2020 04:12:17 PM UTC, original submission:  

I know the BUGS section of the man page mentions "The -L option is incompatible with the -I option, but perhaps should not be." So while I would expect the combination of the two to never work given that sentence in the man page, some coworkers have apparently been using them together for years. Here's an example with a three line file:


$ cat test.txt | xargs -I{} -L1 bash -c "echo {}"
{}
{}
{}
$ cat test.txt | xargs -L1 -I{} bash -c "echo {}"
a
b
c


It seems the order of the -L and -I arguments determines the output which was unexpected. This has been noticed on the xargs that comes with CentOS 6/7 and Ubuntu, but the BSD version that comes with OSX seems to not depend on the order.

Version info:

$ xargs --version
xargs (GNU findutils) 4.6.0.225-235f
Copyright (C) 2019 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by Eric B. Decker, James Youngman, and Kevin Dalley.

David Hoese <djhoese>

 

(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 berny (Posted a comment)
  • -email is unavailable- added by djhoese (Submitted the item)
  • -email is unavailable- added by djhoese
  •  

    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
    2021-01-04 berny StatusNone Duplicate
        Assigned toNone berny
    2020-04-10 djhoese Carbon-Copy- Added rayg@

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code