Busybox `xargs -I`- ignore empty lines

Franciszek Koltuniuk franciszek.koltuniuk at consult.red
Wed Sep 23 09:46:09 UTC 2020


Hi All,
 Please find in attachment a new patch that replace a fix for a bug :

"echo -n | xargs -I% echo %" would SEG

Commit:
https://git.busybox.net/busybox/commit/findutils/xargs.c?id=6d777b75ed322ea5ef0d1674ddfee1b5713cb04f

Currently available solution fixes SEGV issue, but the execution of
'xargs -I' behavior is different than the xargs from (GNU findutils).

Please see the example:
~$ cat ~/tmp/xargs-test
--- start file xargs-test ---

line number 2

line number 4


--- end file xargs-test ---

* output from xargs (GNU findutils) 4.7.0:

~$ cat ~/tmp/xargs-test | /usr/bin/xargs -I % echo %
line number 2
line number 4
~$

* output xargs from BusyBox v1.30.1 (Ubuntu 1:1.30.1-4ubuntu6.1)
multi-call binary):

~$ cat ~/tmp/xargs-test | busybox xargs -I % echo %echo %
~$

I thing that xargs from GNY findutils is expected. The patch:
 0001-busybox-xargs-I-ignore-empty-lines.patch
remove the changes within the commit
6d777b75ed322ea5ef0d1674ddfee1b5713cb04f and introduce new behavior -
empty lines are ignored.

Regards,
 Franciszek

-- 
Franciszek Koltuniuk
w:	consult.red <https://consult.red>
e:	franciszek.koltuniuk at consult.red
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-busybox-xargs-I-ignore-empty-lines.patch
Type: text/x-patch
Size: 2310 bytes
Desc: not available
URL: <http://lists.busybox.net/pipermail/busybox/attachments/20200923/e1a3582d/attachment.bin>


More information about the busybox mailing list