From 4a1abba8541550b7f912d5aa409ca059125a0567 Mon Sep 17 00:00:00 2001 From: Ole Tange Date: Wed, 6 Apr 2016 00:33:34 +0200 Subject: [PATCH] Fixed bug #47608: parallel --nonall -S lo 'echo ::: ' blocks. --- src/parallel | 6 ++++-- testsuite/tests-to-run/parallel-local-ssh3.sh | 3 +++ testsuite/wanted-results/parallel-local-ssh3 | 4 ++++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/parallel b/src/parallel index 3e5d0c9d..fd54d2cb 100755 --- a/src/parallel +++ b/src/parallel @@ -1031,11 +1031,13 @@ sub parse_options { $opt::compress_program ||= $compress; $opt::decompress_program ||= $decompress; } - if(defined $opt::nonall - and not grep /\Q$Global::arg_sep\E|\Q$Global::arg_sep\E/, @ARGV) { + if(defined $opt::nonall) { # Append a dummy empty argument if there are no arguments # on the command line to avoid reading from STDIN. + # arg_sep = random 50 char # \0 => nothing (not the empty string) + $Global::arg_sep = join "", + map { (0..9,"a".."z","A".."Z")[rand(62)] } (1..50); push @ARGV, $Global::arg_sep, "\0"; } if(defined $opt::tty) { diff --git a/testsuite/tests-to-run/parallel-local-ssh3.sh b/testsuite/tests-to-run/parallel-local-ssh3.sh index 096df1a0..a4c16da1 100644 --- a/testsuite/tests-to-run/parallel-local-ssh3.sh +++ b/testsuite/tests-to-run/parallel-local-ssh3.sh @@ -74,4 +74,7 @@ echo '### bug #45907: --header : + --return {header}' ppar --header : -S parallel@lo --return {G} --cleanup echo {G} '>' {G} ::: G returnfile45907; ls returnfile45907 +echo "### bug #47608: parallel --nonall -S lo 'echo ::: ' blocks" + parallel --nonall -S lo 'echo ::: ' + EOF diff --git a/testsuite/wanted-results/parallel-local-ssh3 b/testsuite/wanted-results/parallel-local-ssh3 index 74802a21..fd00ca94 100644 --- a/testsuite/wanted-results/parallel-local-ssh3 +++ b/testsuite/wanted-results/parallel-local-ssh3 @@ -113,3 +113,7 @@ echo '### bug #45907: --header : + --return {header}' ### bug #45907: --header : + --return {header} rm returnfile45907; ppar --header : -S parallel@lo --return {G} --cleanup echo {G} '>' {G} ::: G returnfile45907; ls returnfile45907 returnfile45907 +echo "### bug #47608: parallel --nonall -S lo 'echo ::: ' blocks" +### bug #47608: parallel --nonall -S lo 'echo ::: ' blocks + parallel --nonall -S lo 'echo ::: ' +:::