bug-findutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[patch #4916] [PATCH] xargs -J (FreeBSD compatibility)


From: Andreas Metzler
Subject: [patch #4916] [PATCH] xargs -J (FreeBSD compatibility)
Date: Sat, 21 Apr 2007 16:47:26 +0000
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.0.11) Gecko/20070217 Iceape/1.0.8 (Debian-1.0.8-4)

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:
---------------------
address@hidden:/tmp$ touch 'blah fasel'
address@hidden:/tmp$ printf 'blah fasel\n' | xargs  -I % ls %
blah fasel
address@hidden:/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:
address@hidden:/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
address@hidden:/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:
address@hidden:/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/





reply via email to

[Prev in Thread] Current Thread [Next in Thread]