Follow-up Comment #5, patch #4916 (project findutils):

Hello,
I am not sure about the patch. (file#9590) Afaict it is supposed to make
xargs act the same way for -J as for -I with a single difference: Replace
only the first instance of replace-string.
----------------------
*prompt*$ printf 'bar fasel\n' | ./xargs -I % echo x % 1 % 2 %
x bar fasel 1 bar fasel 2 bar fasel
*prompt*$ printf 'bar fasel\n' | ./xargs -J % echo x % 1 % 2 %
x bar fasel 1 % 2 %
----------------------

However afaiui the FreeBSD manpage there are at least two other significant
differences. "-I" changes xargs' behavior in multiple aspects:
#1 split only on line ends instead of also on space:
---------------------
[EMAIL PROTECTED]:/tmp$ touch 'blah fasel'
[EMAIL PROTECTED]:/tmp$ printf 'blah fasel\n' | xargs  -I % ls %
blah fasel
[EMAIL PROTECTED]:/tmp$ printf 'blah fasel\n' | xargs  ls
ls: blah: No such file or directory
ls: fasel: No such file or directory
---------------------
#2 execute utility *once* for every line of input instead of making the
commandline longer.

Afaiu the manpage "-J" is not supposed to make either of these two changes to
xargs' default behavior, i.e. this should be the resulting behavior:
[EMAIL PROTECTED]:/tmp$ printf 'blah fasel\nnonexist\n' | xargs -J % ls %
ls: blah: No such file or directory
ls: fasel: No such file or directory
ls: nonexist: No such file or directory
[EMAIL PROTECTED]:/tmp$ printf 'blah fasel\nnonexist\n' | xargs -J % echo x %
x blah fasel nonexist

The above mentioned difference #1 between FreeBSD xargs and patched GNU-find
causes different results, #2 only degraded performance.

On top of that the patch seems to be buggy with respect to multiline input.
Only the first line of input is actually passed on:
[EMAIL PROTECTED]:/tmp$ printf 'blah fasel\nnonexist\n' |
/tmp/findutils-4.2.27/xargs/xargs -J % echo x %
x blah fasel
x %

Sorry for the delay in following up.

cu andreas
PS: I have not got access to a FreeBSD system to actually test its behavior,
my only source of input is the online manpage.


    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/patch/?4916>

_______________________________________________
  Nachricht geschickt von/durch Savannah
  http://savannah.gnu.org/



_______________________________________________
Bug-findutils mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/bug-findutils

Reply via email to