bugfindutils - Bugs: bug #13041, -I (-i) and -L shouldn't be...

 
 

bug #13041: -I (-i) and -L shouldn't be exclusive

Submitted by:  None
Submitted on:  Mon 09 May 2005 11:59:32 PM UTC  
 
Category:  xargs Severity:  3 - Normal
Item Group:  Wrong result Status:  Wont Fix
Privacy:  Public Assigned to:  James Youngman <jay>
Originator Name:  Alejandro Forero Cuervo Originator Email:  -email is unavailable-
Open/Closed:  Closed Release:  4.1.20
Fixed Release:  None

Add a New Comment (Rich Markup)
   

You are not logged in

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

 

Sat 03 Sep 2005 10:28:19 AM UTC, comment #5: 

As things turn out, findutils is behaving in the same way as many other implementations, and BSD's behaviour, though sensible, is unusual.   Therefore I don't plan to change the software but rather to apply your patch updating the documentation.

James Youngman <jay>
Project AdministratorIn charge of this item.
Fri 15 Jul 2005 10:16:45 PM UTC, comment #4: 

There is also a recent POSIX interp which is relevant.

James Youngman <jay>
Project AdministratorIn charge of this item.
Sun 19 Jun 2005 11:05:35 AM UTC, comment #3: 

On *BSD,

yes x | head -10 | xargs -I Z -L 10 echo foo Z bar

produces:

foo x x x x x bar
foo x x x x x bar

However, GNU findutils currently assumes that {} (or in this case Z) expands to just one argument.

Fixing this is probably going to mean a significant code change and I'm trying to concentrate on producing a stable release.  I will make the release and then work on this bug.

James Youngman <jay>
Project AdministratorIn charge of this item.
Sun 19 Jun 2005 08:07:46 AM UTC, comment #2: 

This is also reported as <http://bugs.debian.org/231480>.

FWIW I do think that this is not only a mising feature but a real bug. "xargs -i -L10" silently acts as "xargs -L10". I'd rather have it bail out with "conflicting options instead". A command-line using -i will not work at all if -i is ignored, as the arguments are given in the wrong order and additionally a literal {} is passed along as argument, too.

(I'd prefer having -i and -L as non-conflicting options, though.)

Andreas Metzler <ametzler>
Tue 10 May 2005 12:03:12 AM UTC, comment #1: 

BTW, I am aware that in this case I can just omit the ‘-i’ and the replace string ‘{}’.  However, in the general case, I want to run “scp {} user@host:dir”, without having one separate process for each file (which requires separate authentication for each file).

Anonymous
Mon 09 May 2005 11:59:32 PM UTC, original submission:  

I can't xargs to work as I would expect it when I give it both the ‘-i’ and ‘-l’ args.  Using ‘-i’ specifies ‘-l1’ (as the documentation indicates) and using ‘-l’ seems to disable the functionality provided by ‘-i’.

This can be evidenced by using the following program:

main ( int argc, char **argv ) { int i; for (i = 0; i < argc; i ++) { printf("Arg %d: [%s]\n", i, argv[i]); } }

When I build it and run it from xargs, I get the following:

> echo -e 'a\nb\nc' | xargs -l10 -i ./test {}

Arg 0: [./test]
Arg 1: [a]
Arg 0: [./test]
Arg 1: [b]
Arg 0: [./test]
Arg 1: [c]

> echo -e 'a\nb\nc' | xargs -i -l10 ./test {}

Arg 0: [./test]
Arg 1: [{}]
Arg 2: [a]
Arg 3: [b]
Arg 4: [c]

>


I was expecting to be able to combine ‘-i’ and ‘-l’ to get:

Arg 0: [./test]
Arg 1: [a]
Arg 2: [b]
Arg 3: [c]

I don't see anything in the semantics of ‘-i’ and ‘-l’ that makes them exclude each other.  Of course, in ‘-i’, the replace string (‘{}’) would get replaced with as many tokens from the input as permitted.

Anonymous

 

(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

 

CC list is empty

 

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

Only logged-in users can vote.

 

 

 

Follow 5 latest changes.

Date Changed by Updated Field Previous Value => Replaced by
2005-10-08 jay Open/ClosedOpen => Closed
2005-09-03 jay StatusNone => Wont Fix
2005-06-19 jay Assigned toNone => jay
    Summary-i and - shouldn't be exclusive => -I (-i) and -L shouldn't be exclusive
2005-05-09 None Carbon-Copy- => Added bachue --AT-- bachue --DOT-- com

Back to the top


Powered by Savane 3.5