Fixed bug #49538: --header : and {= =}.

This commit is contained in:
Ole Tange 2016-11-05 18:58:46 +01:00
parent 55eaf48197
commit e458f35453
7 changed files with 31 additions and 6 deletions

View file

@ -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++;

View file

@ -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

View file

@ -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() {

View file

@ -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 '**'

View file

@ -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

View file

@ -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

View file

@ -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%