diff --git a/src/parallel b/src/parallel index d0d61739..68a79c8b 100755 --- a/src/parallel +++ b/src/parallel @@ -79,6 +79,12 @@ if($opt::header and not $opt::pipe) { # $header force $colsep = \t if undef? my $delimiter = $opt::colsep; $delimiter ||= "\t"; + # regexp for {= + my $left = "\Q$Global::parensleft\E"; + my $l = $Global::parensleft; + # regexp for =} + my $right = "\Q$Global::parensright\E"; + my $r = $Global::parensright; my $id = 1; for my $fh (@input_source_fh) { my $line = <$fh>; @@ -89,6 +95,8 @@ if($opt::header and not $opt::pipe) { # Replace {colname} with {2} for(@command,@Global::ret_files,@Global::transfer_files) { s:\{$s(|/|//|\.|/\.)\}:\{$id$1\}:g; + # {=header1 ... =} => {=1 ... =} + s:$left $s (.*?) $right:$l$id$1$r:gx; } $Global::input_source_header{$id} = $s; $id++; diff --git a/testsuite/tests-to-run/parallel-local-0.3s.sh b/testsuite/tests-to-run/parallel-local-0.3s.sh index 76be9662..4569ee5b 100644 --- a/testsuite/tests-to-run/parallel-local-0.3s.sh +++ b/testsuite/tests-to-run/parallel-local-0.3s.sh @@ -647,6 +647,13 @@ echo '### bug #48658: --linebuffer --files' echo '**' +bug #49538: --header and {= =} + + parallel --header : echo '{=v2=}{=v1 $_=Q($_)=}' ::: v1 K ::: v2 O + parallel --header : echo '{2}{=1 $_=Q($_)=}' ::: v2 K ::: v1 O + +echo '**' + EOF echo '### 1 .par file from --files expected' find /tmp{/*,}/*.{par,tms,tmx} 2>/dev/null -mmin -10 | wc -l diff --git a/testsuite/tests-to-run/parallel-local-100s.sh b/testsuite/tests-to-run/parallel-local-100s.sh index 2bdefb6a..7e375d33 100644 --- a/testsuite/tests-to-run/parallel-local-100s.sh +++ b/testsuite/tests-to-run/parallel-local-100s.sh @@ -18,7 +18,8 @@ par_retries_unreachable() { par_outside_file_handle_limit() { echo "### Test Force outside the file handle limit, 2009-02-17 Gave fork error" (echo echo Start; seq 1 20000 | perl -pe 's/^/true /'; echo echo end) | - stdout parallel -uj 0 | egrep -v 'processes took|adjusting' + stdout parallel -uj 0 | egrep -v 'processes took|adjusting' | + perl -pe 's/\d\d\d/999/' } par_over_4GB() { diff --git a/testsuite/tests-to-run/parallel-local-10s.sh b/testsuite/tests-to-run/parallel-local-10s.sh index 747a8275..4a1e8f13 100644 --- a/testsuite/tests-to-run/parallel-local-10s.sh +++ b/testsuite/tests-to-run/parallel-local-10s.sh @@ -6,7 +6,8 @@ cat <<'EOF' | sed -e 's/;$/; /;s/$SERVER1/'$SERVER1'/;s/$SERVER2/'$SERVER2'/' | stdout parallel -vj0 -k --joblog /tmp/jl-`basename $0` -L1 echo '### bug #46214: Using --pipepart doesnt spawn multiple jobs in version 20150922' seq 1000000 > /tmp/num1000000; - stdout parallel --pipepart --progress -a /tmp/num1000000 --block 10k -j0 true |grep 1:local + stdout parallel --pipepart --progress -a /tmp/num1000000 --block 10k -j0 true | + grep 1:local | perl -pe 's/\d\d\d/999/g' echo '**' diff --git a/testsuite/wanted-results/parallel-local-0.3s b/testsuite/wanted-results/parallel-local-0.3s index ff6efa9a..befaa983 100644 --- a/testsuite/wanted-results/parallel-local-0.3s +++ b/testsuite/wanted-results/parallel-local-0.3s @@ -1765,5 +1765,13 @@ echo '### bug #48658: --linebuffer --files' 10 echo '**' ** +bug #49538: --header and {= =} +/bin/bash: bug: command not found + parallel --header : echo '{=v2=}{=v1 $_=Q($_)=}' ::: v1 K ::: v2 O +OK + parallel --header : echo '{2}{=1 $_=Q($_)=}' ::: v2 K ::: v1 O +OK +echo '**' +** ### 1 .par file from --files expected 10 diff --git a/testsuite/wanted-results/parallel-local-100s b/testsuite/wanted-results/parallel-local-100s index 1c4271c8..a478f736 100644 --- a/testsuite/wanted-results/parallel-local-100s +++ b/testsuite/wanted-results/parallel-local-100s @@ -3,8 +3,8 @@ par_mem_leak ### test for mem leak par_mem_leak no mem leak detected par_outside_file_handle_limit 2>&1 par_outside_file_handle_limit ### Test Force outside the file handle limit, 2009-02-17 Gave fork error -par_outside_file_handle_limit parallel: Warning: Only enough file handles to run 252 jobs in parallel. -par_outside_file_handle_limit parallel: Warning: Running 'parallel -j0 -N 252 --pipe parallel -j0' or +par_outside_file_handle_limit parallel: Warning: Only enough file handles to run 999 jobs in parallel. +par_outside_file_handle_limit parallel: Warning: Running 'parallel -j0 -N 999 --pipe parallel -j0' or par_outside_file_handle_limit parallel: Warning: raising ulimit -n or /etc/security/limits.conf may help. par_outside_file_handle_limit Start par_outside_file_handle_limit end diff --git a/testsuite/wanted-results/parallel-local-10s b/testsuite/wanted-results/parallel-local-10s index f29e7a45..5648b9a5 100644 --- a/testsuite/wanted-results/parallel-local-10s +++ b/testsuite/wanted-results/parallel-local-10s @@ -1,7 +1,7 @@ echo '### bug #46214: Using --pipepart doesnt spawn multiple jobs in version 20150922' ### bug #46214: Using --pipepart doesnt spawn multiple jobs in version 20150922 - seq 1000000 > /tmp/num1000000; stdout parallel --pipepart --progress -a /tmp/num1000000 --block 10k -j0 true |grep 1:local -1:local / 8 / 252 + 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' +1:local / 8 / 999 echo '**' ** testhalt() { echo '### testhalt --halt '$1; (yes 0 | head -n 10; seq 10) | stdout parallel -kj4 --halt $1 'sleep {= $_=$_*0.3+1 =}; exit {}'; echo $?; (seq 10; yes 0 | head -n 10) | stdout parallel -kj4 --halt $1 'sleep {= $_=$_*0.3+1 =}; exit {}'; echo $?; }; export -f testhalt; parallel -kj0 testhalt ::: now,fail=0 now,fail=1 now,fail=2 now,fail=30% now,fail=70% soon,fail=0 soon,fail=1 soon,fail=2 soon,fail=30% soon,fail=70% now,success=0 now,success=1 now,success=2 now,success=30% now,success=70% soon,success=0 soon,success=1 soon,success=2 soon,success=30% now,success=70%