mirror of
https://git.savannah.gnu.org/git/parallel.git
synced 2024-12-23 13:17:54 +00:00
Fixed bug #33743: -q quotes # in {#}.
This commit is contained in:
parent
fe8a8aa41b
commit
cf2b12eea8
|
@ -45,6 +45,8 @@ my $command;
|
||||||
if(@ARGV) {
|
if(@ARGV) {
|
||||||
if($Global::quoting) {
|
if($Global::quoting) {
|
||||||
$command = shell_quote(@ARGV);
|
$command = shell_quote(@ARGV);
|
||||||
|
# {#} is a replacement string and should not be quoted
|
||||||
|
$command =~ s/{\\#}/{#}/g;
|
||||||
} else {
|
} else {
|
||||||
$command = join(" ", @ARGV);
|
$command = join(" ", @ARGV);
|
||||||
}
|
}
|
||||||
|
@ -1972,7 +1974,9 @@ sub loadavg {
|
||||||
if($uptime_out =~ /load average: (\d+.\d+)/) {
|
if($uptime_out =~ /load average: (\d+.\d+)/) {
|
||||||
$self->{'loadavg'} = $1;
|
$self->{'loadavg'} = $1;
|
||||||
::debug("New loadavg: ".$self->{'loadavg'});
|
::debug("New loadavg: ".$self->{'loadavg'});
|
||||||
}
|
} else {
|
||||||
|
::die_bug("loadavg_invalid_content: $uptime_out");
|
||||||
|
}
|
||||||
::debug("Last update: ".$self->{'last_loadavg_update'});
|
::debug("Last update: ".$self->{'last_loadavg_update'});
|
||||||
if(time - $self->{'last_loadavg_update'} > 10) {
|
if(time - $self->{'last_loadavg_update'} > 10) {
|
||||||
# last loadavg was started 10 seconds ago
|
# last loadavg was started 10 seconds ago
|
||||||
|
|
|
@ -31,6 +31,7 @@ send "y\n"
|
||||||
expect "opt--interactive 3"
|
expect "opt--interactive 3"
|
||||||
_EOF
|
_EOF
|
||||||
|
|
||||||
|
cat <<'EOF' | parallel -j0 -k
|
||||||
echo '### Test -L -l and --max-lines'
|
echo '### Test -L -l and --max-lines'
|
||||||
(echo a_b;echo c) | parallel -km -L2 echo
|
(echo a_b;echo c) | parallel -km -L2 echo
|
||||||
(echo a_b;echo c) | parallel -k -L2 echo
|
(echo a_b;echo c) | parallel -k -L2 echo
|
||||||
|
@ -82,14 +83,16 @@ echo '### Test -x'
|
||||||
(seq 1 10; echo 1234; seq 12 15) | stdout parallel -j1 -km -s 10 -x echo
|
(seq 1 10; echo 1234; seq 12 15) | stdout parallel -j1 -km -s 10 -x echo
|
||||||
(seq 1 10; echo 1234; seq 12 15) | stdout parallel -j1 -kX -s 10 -x echo
|
(seq 1 10; echo 1234; seq 12 15) | stdout parallel -j1 -kX -s 10 -x echo
|
||||||
(seq 1 10; echo 1234; seq 12 15) | stdout xargs -s 10 -x echo
|
(seq 1 10; echo 1234; seq 12 15) | stdout xargs -s 10 -x echo
|
||||||
#echo '### Test bugfix if no command given'
|
EOF
|
||||||
#(echo echo; seq 1 5; perl -e 'print "z"x1000000'; seq 12 15) | stdout parallel -j1 -km -s 10
|
|
||||||
|
|
||||||
echo '### Test -a and --arg-file: Read input from file instead of stdin'
|
echo '### Test -a and --arg-file: Read input from file instead of stdin'
|
||||||
seq 1 10 >/tmp/$$
|
seq 1 10 >/tmp/$$
|
||||||
parallel -k -a /tmp/$$ echo
|
parallel -k -a /tmp/$$ echo
|
||||||
parallel -k --arg-file /tmp/$$ echo
|
parallel -k --arg-file /tmp/$$ echo
|
||||||
|
|
||||||
|
#echo '### Test bugfix if no command given'
|
||||||
|
#(echo echo; seq 1 5; perl -e 'print "z"x1000000'; seq 12 15) | stdout parallel -j1 -km -s 10
|
||||||
|
|
||||||
cd input-files/test15
|
cd input-files/test15
|
||||||
|
|
||||||
echo 'xargs Expect: 3 1 2'
|
echo 'xargs Expect: 3 1 2'
|
||||||
|
@ -114,6 +117,15 @@ chmod 755 /tmp/parallel-script-for-script2
|
||||||
echo via pseudotty | script -q -f -c /tmp/parallel-script-for-script2 /dev/null
|
echo via pseudotty | script -q -f -c /tmp/parallel-script-for-script2 /dev/null
|
||||||
sleep 1
|
sleep 1
|
||||||
|
|
||||||
|
echo '### Hans found a bug giving unitialized variable'
|
||||||
|
echo >/tmp/parallel_f1
|
||||||
|
echo >/tmp/parallel_f2'
|
||||||
|
'
|
||||||
|
echo /tmp/parallel_f1 /tmp/parallel_f2 | stdout parallel -kv --delimiter ' ' gzip
|
||||||
|
rm /tmp/parallel_f*
|
||||||
|
|
||||||
|
|
||||||
|
cat <<'EOF' | parallel -j0 -k
|
||||||
echo '### Test -i and --replace: Replace with argument'
|
echo '### Test -i and --replace: Replace with argument'
|
||||||
(echo a; echo END; echo b) | parallel -k -i -eEND echo repl{}ce
|
(echo a; echo END; echo b) | parallel -k -i -eEND echo repl{}ce
|
||||||
(echo a; echo END; echo b) | parallel -k --replace -eEND echo repl{}ce
|
(echo a; echo END; echo b) | parallel -k --replace -eEND echo repl{}ce
|
||||||
|
@ -160,13 +172,6 @@ echo line 1Nline 2Nline 3 | parallel -k --delimiter N echo This is
|
||||||
printf "delimiter NUL line 1\0line 2\0line 3" | parallel -k -d '\0' echo
|
printf "delimiter NUL line 1\0line 2\0line 3" | parallel -k -d '\0' echo
|
||||||
printf "delimiter TAB line 1\tline 2\tline 3" | parallel -k --delimiter '\t' echo
|
printf "delimiter TAB line 1\tline 2\tline 3" | parallel -k --delimiter '\t' echo
|
||||||
|
|
||||||
echo '### Hans found a bug giving unitialized variable'
|
|
||||||
echo >/tmp/parallel_f1
|
|
||||||
echo >/tmp/parallel_f2'
|
|
||||||
'
|
|
||||||
echo /tmp/parallel_f1 /tmp/parallel_f2 | stdout parallel -kv --delimiter ' ' gzip
|
|
||||||
rm /tmp/parallel_f*
|
|
||||||
|
|
||||||
echo '### Test --max-chars and -s: Max number of chars in a line'
|
echo '### Test --max-chars and -s: Max number of chars in a line'
|
||||||
(echo line 1;echo line 1;echo line 2) | parallel -k --max-chars 25 -X echo
|
(echo line 1;echo line 1;echo line 2) | parallel -k --max-chars 25 -X echo
|
||||||
(echo line 1;echo line 1;echo line 2) | parallel -k -s 25 -X echo
|
(echo line 1;echo line 1;echo line 2) | parallel -k -s 25 -X echo
|
||||||
|
@ -190,3 +195,4 @@ echo '### Test --verbose and -t'
|
||||||
echo '### Test --show-limits'
|
echo '### Test --show-limits'
|
||||||
(echo b; echo c; echo f) | parallel -k --show-limits echo {}ar
|
(echo b; echo c; echo f) | parallel -k --show-limits echo {}ar
|
||||||
(echo b; echo c; echo f) | parallel -j1 -kX --show-limits -s 100 echo {}ar
|
(echo b; echo c; echo f) | parallel -j1 -kX --show-limits -s 100 echo {}ar
|
||||||
|
EOF
|
||||||
|
|
10
testsuite/tests-to-run/test63.sh
Normal file
10
testsuite/tests-to-run/test63.sh
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
echo '### Test -q'
|
||||||
|
parallel -kq perl -e '$ARGV[0]=~/^\S+\s+\S+$/ and print $ARGV[0],"\n"' ::: "a b" c "d e f" g "h i"
|
||||||
|
|
||||||
|
echo '### Test -q {#}'
|
||||||
|
parallel -kq echo {#} ::: a b
|
||||||
|
parallel -kq echo {\#} ::: a b
|
||||||
|
parallel -kq echo {\\#} ::: a b
|
||||||
|
|
|
@ -189,6 +189,10 @@ parallel Expect: 1 3 2 via pseudotty
|
||||||
3
|
3
|
||||||
2
|
2
|
||||||
via pseudotty
|
via pseudotty
|
||||||
|
### Hans found a bug giving unitialized variable
|
||||||
|
gzip /tmp/parallel_f1
|
||||||
|
gzip /tmp/parallel_f2'
|
||||||
|
'
|
||||||
### Test -i and --replace: Replace with argument
|
### Test -i and --replace: Replace with argument
|
||||||
replace
|
replace
|
||||||
replace
|
replace
|
||||||
|
@ -275,10 +279,6 @@ line 3
|
||||||
delimiter TAB line 1
|
delimiter TAB line 1
|
||||||
line 2
|
line 2
|
||||||
line 3
|
line 3
|
||||||
### Hans found a bug giving unitialized variable
|
|
||||||
gzip /tmp/parallel_f1
|
|
||||||
gzip /tmp/parallel_f2'
|
|
||||||
'
|
|
||||||
### Test --max-chars and -s: Max number of chars in a line
|
### Test --max-chars and -s: Max number of chars in a line
|
||||||
line 1 line 1
|
line 1 line 1
|
||||||
line 2
|
line 2
|
||||||
|
|
|
@ -4,21 +4,21 @@ parallel [options] [command [arguments]] < list_of_arguments
|
||||||
parallel [options] [command [arguments]] (::: arguments|:::: argfile(s))...
|
parallel [options] [command [arguments]] (::: arguments|:::: argfile(s))...
|
||||||
cat ... | parallel --pipe [options] [command [arguments]]
|
cat ... | parallel --pipe [options] [command [arguments]]
|
||||||
|
|
||||||
-j n Run n jobs in parallel
|
-j n Run n jobs in parallel
|
||||||
-k Keep same order
|
-k Keep same order
|
||||||
-X Multiple arguments with context replace
|
-X Multiple arguments with context replace
|
||||||
--colsep regexp Split input on regexp for positional replacements
|
--colsep regexp Split input on regexp for positional replacements
|
||||||
{} {.} {/} {/.} {#} Replacement strings
|
{} {.} {/} {/.} {#} Replacement strings
|
||||||
{3} {3.} {3/} {3/.} Positional replacement strings
|
{3} {3.} {3/} {3/.} Positional replacement strings
|
||||||
|
|
||||||
-S sshlogin - e.g. foo@server.example.com
|
-S sshlogin Example: foo@server.example.com
|
||||||
--trc {}.bar Shorthand for --transfer --return {}.bar --cleanup
|
--trc {}.bar Shorthand for --transfer --return {}.bar --cleanup
|
||||||
--onall Run the given command with argument on all sshlogins
|
--onall Run the given command with argument on all sshlogins
|
||||||
--nonall Run the given command with no arguments on all sshlogins
|
--nonall Run the given command with no arguments on all sshlogins
|
||||||
|
|
||||||
--pipe Split stdin (standard input) to multiple jobs.
|
--pipe Split stdin (standard input) to multiple jobs.
|
||||||
--recend Record end separator for --pipe.
|
--recend str Record end separator for --pipe.
|
||||||
--recstart Record start separator for --pipe.
|
--recstart str Record start separator for --pipe.
|
||||||
|
|
||||||
See 'man parallel' for details
|
See 'man parallel' for details
|
||||||
Parsing of --jobs/-j/--max-procs/-P failed
|
Parsing of --jobs/-j/--max-procs/-P failed
|
||||||
|
|
10
testsuite/wanted-results/test63
Normal file
10
testsuite/wanted-results/test63
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
### Test -q
|
||||||
|
a b
|
||||||
|
h i
|
||||||
|
### Test -q {#}
|
||||||
|
1
|
||||||
|
2
|
||||||
|
1
|
||||||
|
2
|
||||||
|
{\#} a
|
||||||
|
{\#} b
|
Loading…
Reference in a new issue