mirror of
https://git.savannah.gnu.org/git/parallel.git
synced 2024-12-22 20:57:53 +00:00
Fixed bug #37694: Empty string argument skipped when using --quote
This commit is contained in:
parent
d720e7959c
commit
a8a451c60c
16
src/parallel
16
src/parallel
|
@ -55,7 +55,7 @@ if($Global::max_number_of_args) {
|
|||
my $command = "";
|
||||
if(@ARGV) {
|
||||
if($Global::quoting) {
|
||||
$command = shell_quote(@ARGV);
|
||||
$command = shell_quote_empty(@ARGV);
|
||||
} else {
|
||||
$command = join(" ", @ARGV);
|
||||
}
|
||||
|
@ -574,7 +574,7 @@ sub options_hash {
|
|||
"wait" => \$opt::wait,
|
||||
# Shebang #!/usr/bin/parallel --shebang
|
||||
"shebang|hashbang" => \$opt::shebang,
|
||||
"--internal-pipe-means-argfiles" => \$opt::internal_pipe_means_argfiles,
|
||||
"internal-pipe-means-argfiles" => \$opt::internal_pipe_means_argfiles,
|
||||
"Y" => \$opt::retired,
|
||||
"skip-first-line" => \$opt::skip_first_line,
|
||||
"header=s" => \$opt::header,
|
||||
|
@ -607,7 +607,7 @@ sub get_options_from_array {
|
|||
sub parse_options {
|
||||
# Returns: N/A
|
||||
# Defaults:
|
||||
$Global::version = 20121123;
|
||||
$Global::version = 20121124;
|
||||
$Global::progname = 'parallel';
|
||||
$Global::infinity = 2**31;
|
||||
$Global::debug = 0;
|
||||
|
@ -1079,6 +1079,16 @@ sub shell_quote {
|
|||
return wantarray ? @strings : "@strings";
|
||||
}
|
||||
|
||||
sub shell_quote_empty {
|
||||
my @strings = shell_quote(@_);
|
||||
for my $a (@strings) {
|
||||
if($a eq "") {
|
||||
$a = "''";
|
||||
}
|
||||
}
|
||||
return wantarray ? @strings : "@strings";
|
||||
}
|
||||
|
||||
sub shell_quote_scalar {
|
||||
# Quote the string so shell will not expand any special chars
|
||||
# Returns:
|
||||
|
|
|
@ -50,6 +50,6 @@ portable:
|
|||
|
||||
timings: tests-to-run/* ../src/parallel
|
||||
ls tests-to-run/*.sh | xargs -n1 echo /usr/bin/time -f %e bash >/tmp/timing.script
|
||||
stdout bash -x /tmp/timing.script >/tmp/timing.out
|
||||
stdout bash -x /tmp/timing.script | tee /tmp/timing.out
|
||||
echo usr.bin.time_END >>/tmp/timing.out
|
||||
perl -ne '/usr.bin.time/ and do { print $$last.$$h; $$h=$$_ }; chomp; $$last = $$_' /tmp/timing.out | sort -n >timings
|
||||
|
|
|
@ -7,7 +7,7 @@ SHFILE=/tmp/unittest-parallel.sh
|
|||
|
||||
# Run a failing test once
|
||||
ls -t tests-to-run/*${1}*.sh \
|
||||
| perl -pe 's:(.*/(.*)).sh:bash $1.sh > actual-results/$2; diff -Naur wanted-results/$2 actual-results/$2: ' \
|
||||
| perl -pe 's:(.*/(.*)).sh:bash $1.sh > actual-results/$2; diff -Naur wanted-results/$2 actual-results/$2 || touch $1.sh:' \
|
||||
>$SHFILE
|
||||
|
||||
# # Try a failing test thrice
|
||||
|
|
|
@ -1,14 +1,4 @@
|
|||
#!/bin/bash
|
||||
|
||||
PAR=parallel
|
||||
|
||||
cd input-files/test08
|
||||
|
||||
ls \
|
||||
| $PAR -q perl -ne '/_PRE (\d+)/ and $p=$1; /hatchname> (\d+)/ and $1!=$p and print $ARGV,"\n"' \
|
||||
| sort
|
||||
|
||||
seq 1 10 | $PAR -j 1 echo | sort
|
||||
seq 1 10 | $PAR -j 2 echo | sort
|
||||
seq 1 10 | $PAR -j 3 echo | sort
|
||||
|
||||
|
|
|
@ -1,7 +1,2 @@
|
|||
#!/bin/bash
|
||||
|
||||
echo "### Computing length of command line"
|
||||
seq 1 2 | parallel -k -N2 echo {1} {2}
|
||||
parallel --xapply -k -a <(seq 11 12) -a <(seq 1 3) echo
|
||||
parallel -k -C %+ echo '"{1}_{3}_{2}_{4}"' ::: 'a% c %%b' 'a%c% b %d'
|
||||
parallel -k -C %+ echo {4} ::: 'a% c %%b'
|
||||
|
|
|
@ -19,4 +19,22 @@ echo '### Test -k 2';
|
|||
|
||||
echo '### Test -k 1';
|
||||
sleep 1
|
||||
|
||||
echo "### Computing length of command line"
|
||||
seq 1 2 | parallel -k -N2 echo {1} {2}
|
||||
parallel --xapply -k -a <(seq 11 12) -a <(seq 1 3) echo
|
||||
parallel -k -C %+ echo '"{1}_{3}_{2}_{4}"' ::: 'a% c %%b' 'a%c% b %d'
|
||||
parallel -k -C %+ echo {4} ::: 'a% c %%b'
|
||||
|
||||
echo "### test08";
|
||||
cd input-files/test08;
|
||||
ls | parallel -q perl -ne '/_PRE (\d+)/ and $p=$1; /hatchname> (\d+)/ and $1!=$p and print $ARGV,"\n"' | sort;
|
||||
|
||||
seq 1 10 | parallel -j 1 echo | sort
|
||||
seq 1 10 | parallel -j 2 echo | sort
|
||||
seq 1 10 | parallel -j 3 echo | sort
|
||||
|
||||
echo "bug #37694: Empty string argument skipped when using --quote"
|
||||
parallel -q --nonall perl -le 'print scalar @ARGV' 'a' 'b' ''
|
||||
|
||||
EOF
|
||||
|
|
|
@ -1,32 +0,0 @@
|
|||
b
|
||||
d
|
||||
1
|
||||
10
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
7
|
||||
8
|
||||
9
|
||||
1
|
||||
10
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
7
|
||||
8
|
||||
9
|
||||
1
|
||||
10
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
7
|
||||
8
|
||||
9
|
|
@ -1,8 +0,0 @@
|
|||
### Computing length of command line
|
||||
1 2
|
||||
11 1
|
||||
12 2
|
||||
3
|
||||
a_b_c_{4}
|
||||
a_b_c_d
|
||||
{4}
|
|
@ -3,3 +3,46 @@
|
|||
### Test -k 4
|
||||
### Test -k 2
|
||||
### Test -k 1
|
||||
### Computing length of command line
|
||||
1 2
|
||||
11 1
|
||||
12 2
|
||||
3
|
||||
a_b_c_{4}
|
||||
a_b_c_d
|
||||
{4}
|
||||
### test08
|
||||
b
|
||||
d
|
||||
1
|
||||
10
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
7
|
||||
8
|
||||
9
|
||||
1
|
||||
10
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
7
|
||||
8
|
||||
9
|
||||
1
|
||||
10
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
7
|
||||
8
|
||||
9
|
||||
bug #37694: Empty string argument skipped when using --quote
|
||||
3
|
||||
|
|
Loading…
Reference in a new issue