sem --quote should not add empty argument.

This commit is contained in:
Ole Tange 2018-12-29 22:33:50 +01:00
parent 9fc4ad53af
commit f9ff5717fe
7 changed files with 40 additions and 29 deletions

View file

@ -10229,13 +10229,14 @@ sub replace_placeholders {
my @quotegroup;
my @quoted;
for (map { $_ eq "\0empty" ? "" : $_ }
grep { $_ ne "\0ign" }
grep { $_ !~ /\0noarg/ }
grep { $_ ne "\0ign" and $_ ne "\0noarg" and $_ ne "'\0noarg'" }
@replaced, "\0end") {
if($_ eq "\0spc" or $_ eq "\0end") {
# \0spc splits quotable groups
if($quote) {
CORE::push @quoted, ::Q(join"",@quotegroup);
if(@quotegroup) {
CORE::push @quoted, ::Q(join"",@quotegroup);
}
} else {
CORE::push @quoted, join"",@quotegroup;
}

View file

@ -881,6 +881,11 @@ par_pipe_N1_regexp() {
parallel -kN1 --recstart 'begin\n' --pipe echo JOB{#}\;cat\;echo END
}
par_sem_quote() {
echo '### sem --quote should not add empty argument'
sem --fg --quote -v echo
}
export -f $(compgen -A function | grep par_)
compgen -A function | grep par_ | LC_ALL=C sort |
parallel --timeout 20 -j6 --tag -k --joblog +/tmp/jl-`basename $0` '{} 2>&1'

View file

@ -67,32 +67,34 @@ par_pipe_line_buffer_compress() {
par__pipepart_spawn() {
echo '### bug #46214: Using --pipepart doesnt spawn multiple jobs in version 20150922'
seq 1000000 > /tmp/num1000000;
stdout nice parallel --pipepart --progress -a /tmp/num1000000 --block 10k -j0 true |
grep 1:local | perl -pe 's/\d\d\d/999/g; s/[2-9]/2+/g;'
seq 1000000 > /tmp/num1000000
stdout parallel --pipepart --progress -a /tmp/num1000000 --block 10k -j0 true |
grep 1:local | perl -pe 's/\d\d\d/999/g; s/[2-9]/2+/g;'
}
par__pipe_tee() {
echo 'bug #45479: --pipe/--pipepart --tee'
echo '--pipe --tee'
random1G() {
random100M() {
< /dev/zero openssl enc -aes-128-ctr -K 1234 -iv 1234 2>/dev/null |
head -c 1G;
head -c 100M;
}
random1G | parallel --pipe --tee cat ::: {1..3} | LC_ALL=C wc -c
random100M | parallel --pipe --tee cat ::: {1..3} | LC_ALL=C wc -c
}
par__pipepart_tee() {
echo 'bug #45479: --pipe/--pipepart --tee'
echo '--pipepart --tee'
random1G() {
export TMPDIR=/dev/shm/parallel
mkdir -p $TMPDIR
random100M() {
< /dev/zero openssl enc -aes-128-ctr -K 1234 -iv 1234 2>/dev/null |
head -c 1G;
head -c 100M;
}
tmp=$(mktemp)
random1G >$tmp
random100M >$tmp
parallel --pipepart --tee -a $tmp cat ::: {1..3} | LC_ALL=C wc -c
rm $tmp
}
@ -193,8 +195,8 @@ par_maxlinelen_X_I() {
par_compress_fail() {
echo "### bug #41609: --compress fails"
seq 12 | parallel --compress --compress-program bzip2 -k seq {} 1000000 | md5sum
seq 12 | parallel --compress -k seq {} 1000000 | md5sum
seq 12 | parallel --compress --compress-program gzip -k seq {} 10000 | md5sum
seq 12 | parallel --compress -k seq {} 10000 | md5sum
}
par_round_robin_blocks() {

View file

@ -148,5 +148,5 @@ export -f $(compgen -A function | egrep 'p_|par_')
# Tested that -j0 in parallel is fastest (up to 15 jobs)
# more than 3 jobs: sqlite locks
compgen -A function | grep par_ | LC_ALL=C sort |
stdout parallel --timeout 300 -vj3 -k --tag --joblog /tmp/jl-`basename $0` p_wrapper \
stdout parallel --timeout 30 -vj50% -k --tag --joblog /tmp/jl-`basename $0` p_wrapper \
:::: - ::: \$MYSQL \$PG \$SQLITE

View file

@ -1512,6 +1512,9 @@ par_retries_replacement_string 22
par_retries_replacement_string 33
par_retries_replacement_string 33
par_retries_replacement_string 33
par_sem_quote ### sem --quote should not add empty argument
par_sem_quote echo
par_sem_quote
par_slow_pipe_regexp ### bug #53718: --pipe --regexp -N blocks
par_slow_pipe_regexp This should take a few ms, but took more than 2 hours
par_slow_pipe_regexp 980 981 5881

View file

@ -5,15 +5,15 @@ par__memleak Test if memory consumption(300 jobs) < memory consumption(30 jobs)
par__memleak 1
par__pipe_tee bug #45479: --pipe/--pipepart --tee
par__pipe_tee --pipe --tee
par__pipe_tee 3221225472
par__pipe_tee 314572800
par__pipepart_spawn ### bug #46214: Using --pipepart doesnt spawn multiple jobs in version 20150922
par__pipepart_spawn 1:local / 2+ / 2+2+2+
par__pipepart_tee bug #45479: --pipe/--pipepart --tee
par__pipepart_tee --pipepart --tee
par__pipepart_tee 3221225472
par__pipepart_tee 314572800
par_compress_fail ### bug #41609: --compress fails
par_compress_fail 24812dd0f24a26d08a780f988b9d5ad2 -
par_compress_fail 24812dd0f24a26d08a780f988b9d5ad2 -
par_compress_fail f1a751b1283e99e7dda40f63f1225f74 -
par_compress_fail f1a751b1283e99e7dda40f63f1225f74 -
par_interactive ### Test -p --interactive
par_interactive opt--interactive 1
par_interactive opt--interactive 3

View file

@ -3,25 +3,25 @@ echo '### Test --load remote'
ssh parallel@lo 'seq 10 | parallel --nice 19 --timeout 15 -j0 -qN0 perl -e while\(1\)\{\ \}' & sleep 1; stdout /usr/bin/time -f %e parallel -S parallel@lo --load 10 sleep ::: 1 | perl -ne '$_ > 10 and print "OK\n"'
OK
parallel: Warning: This job was killed because it timed out:
parallel: Warning: perl -e 'while(1){ }' ''
parallel: Warning: perl -e 'while(1){ }'
parallel: Warning: This job was killed because it timed out:
parallel: Warning: perl -e 'while(1){ }' ''
parallel: Warning: perl -e 'while(1){ }'
parallel: Warning: This job was killed because it timed out:
parallel: Warning: perl -e 'while(1){ }' ''
parallel: Warning: perl -e 'while(1){ }'
parallel: Warning: This job was killed because it timed out:
parallel: Warning: perl -e 'while(1){ }' ''
parallel: Warning: perl -e 'while(1){ }'
parallel: Warning: This job was killed because it timed out:
parallel: Warning: perl -e 'while(1){ }' ''
parallel: Warning: perl -e 'while(1){ }'
parallel: Warning: This job was killed because it timed out:
parallel: Warning: perl -e 'while(1){ }' ''
parallel: Warning: perl -e 'while(1){ }'
parallel: Warning: This job was killed because it timed out:
parallel: Warning: perl -e 'while(1){ }' ''
parallel: Warning: perl -e 'while(1){ }'
parallel: Warning: This job was killed because it timed out:
parallel: Warning: perl -e 'while(1){ }' ''
parallel: Warning: perl -e 'while(1){ }'
parallel: Warning: This job was killed because it timed out:
parallel: Warning: perl -e 'while(1){ }' ''
parallel: Warning: perl -e 'while(1){ }'
parallel: Warning: This job was killed because it timed out:
parallel: Warning: perl -e 'while(1){ }' ''
parallel: Warning: perl -e 'while(1){ }'
echo '**'
**
echo '### Stop if all hosts are filtered and there are no hosts left to run on'