diff options
author | Ron Yorston <rmy@pobox.com> | 2020-02-19 11:01:39 +0000 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2020-04-29 15:53:51 +0200 |
commit | 1c462d47a0bc92f9f57af223456df53169acf3fe (patch) | |
tree | 8ded03ad3eaa86b931d42c70492f404107fa9e4e /testsuite | |
parent | ed8af51b600fd16d22c6663a241547c3a9d7f2b4 (diff) | |
download | busybox-1c462d47a0bc92f9f57af223456df53169acf3fe.tar.gz |
xargs: restore correct behaviour of -n option
Since commit 1ff7002b1 (xargs: fix handling of quoted arguments, closes
11441) the -n option hasn't worked properly:
$ echo 1 2 3 | xargs -n 1 echo
1
2
3
$
Because state is now remembered between calls to process_stdin() it's
necessary to update the state before any premature return.
Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'testsuite')
-rwxr-xr-x | testsuite/xargs.tests | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/testsuite/xargs.tests b/testsuite/xargs.tests index 855b33bc2..159f1ff69 100755 --- a/testsuite/xargs.tests +++ b/testsuite/xargs.tests @@ -48,6 +48,17 @@ testing "xargs argument line too long" \ "seq 10000 99999 | sed -e 's/^/\"/' -e 's/$/\"/' | xargs echo | grep -o 99999; echo \$?" \ "99999\n0\n" \ "" "" + +testing "xargs -n1" \ + "xargs -n1 echo" \ + "1\n2\n3\n4\n5\n" \ + "" "1 2 3 4 5\n" + +testing "xargs -n2" \ + "xargs -n2 echo" \ + "1 2\n3 4\n5\n" \ + "" "1 2 3 4 5\n" + SKIP= exit $FAILCOUNT |