Fixed bug #45939: {2} in {= =} fails.

This commit is contained in:
Ole Tange 2015-09-12 17:51:43 +02:00
parent 285e9209a4
commit a7ac76158f
3 changed files with 17 additions and 4 deletions

View file

@ -8353,11 +8353,14 @@ sub new {
$posrpl = $rpl;
if($posrpl =~ s/^\{//) {
# Only do this if the shorthand start with {
s{\{(-?\d+)\Q$posrpl\E}
{\257<$1 $Global::rpl{$rpl}\257>}g;
while(s{((^|\257>)[^\257]*?) # Don't replace after \257 unless \257>
\{(-?\d+)\Q$posrpl\E}
{$1\257<$3 $Global::rpl{$rpl}\257>}xg) {
}
}
}
}
# Add {} if no replacement strings in @command
($replacecount_ref, $len_ref, @command) =
replacement_counts_and_lengths($return_files,@command);
@ -9077,9 +9080,9 @@ sub new {
sub Q {
# Q alias for ::shell_quote_scalar
# Run shell_quote_scalar once to set the reference to the sub
my @a = ::shell_quote_scalar(@_);
my $a = ::shell_quote_scalar(@_);
*Q = \&::shell_quote_scalar;
return @a;
return $a;
}
{

View file

@ -202,6 +202,10 @@ parallel -k echo '{=1 $_=++$::G =}' ::: {1001..1004} ::: {a..c}
echo '**'
echo '### bug #45939: {2} in {= =} fails'
parallel echo '{= s/O{2}//=}' ::: OOOK
parallel echo '{2}-{=1 s/O{2}//=}' ::: OOOK ::: OK
EOF
echo '### 1 .par file from --files expected'
find /tmp{/*,}/*.{par,tms,tmx} 2>/dev/null -mmin -10 | wc -l

View file

@ -430,5 +430,11 @@ parallel -k echo '{=1 $_=++$::G =}' ::: {1001..1004} ::: {a..c}
12
echo '**'
**
echo '### bug #45939: {2} in {= =} fails'
### bug #45939: {2} in {= =} fails
parallel echo '{= s/O{2}//=}' ::: OOOK
OK
parallel echo '{2}-{=1 s/O{2}//=}' ::: OOOK ::: OK
OK-OK
### 1 .par file from --files expected
1