Actions
Bug #4857
closedxargs(1) -n and -I combine to do potentially the wrong thing
Start date:
2014-05-09
Due date:
% Done:
100%
Estimated time:
Difficulty:
Medium
Tags:
Gerrit CR:
Description
We do these two things, which seems clearly wrong:
$ echo foo bar baz other | /bin/xargs -n 1 -I THING echo '** THING **' ** other ** foo bar baz
$ echo foo bar baz other | /bin/xargs -I THING -n 1 echo '** THING **' ** THING ** foo ** THING ** bar ** THING ** baz ** THING ** other
GNU does (regardless the order of the -n and -I options)
$ echo foo bar baz other | /usr/gnu/bin/xargs -n 1 -I THING echo '** THING **' ** foo bar baz other **
Which isn't what I expected either.
OS X does:
echo foo bar baz other | /usr/bin/xargs -n 1 -I THING echo '** THING **' ** foo ** ** bar ** ** baz ** ** other **
Which is what I expected.
I'd say it's obvious that what our xargs(1) is doing is wrong. I'm not certain if there's some weird reason that what GNU xargs is doing is correct, if unexpected, as compared to the OS X behaviour though.
I'd expect that (value of -n) options would be pasted where THING is, so that we'd get the OSX behaviour where -n 1, two items where -n 2, etc. The default being such that they all paste there, with so few options. Whether the standards and whatnot agree with me I don't know.
Actions