From 4e9170978aabe6ac079f99faa35847a4d491938a Mon Sep 17 00:00:00 2001 From: Ole Tange Date: Fri, 26 Dec 2014 12:02:31 +0100 Subject: [PATCH] parallel: quoting of replacement string. --- src/parallel | 9 ++++++--- testsuite/wanted-results/parallel-local12 | 6 ++++-- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/parallel b/src/parallel index ddd5a8b0..ef3d7a31 100755 --- a/src/parallel +++ b/src/parallel @@ -1481,7 +1481,7 @@ sub shell_quote { # @shell_quoted_strings = string quoted with \ as needed by the shell my @strings = (@_); for my $a (@strings) { - $a =~ s/([\002-\011\013-\032\\\#\?\`\(\)\{\}\[\]\*\>\<\~\|\; \"\!\$\&\'\202-\377])/\\$1/g; + $a =~ s/([\002-\011\013-\032\\\#\?\`\(\)\{\}\[\]\^\*\>\<\~\|\; \"\!\$\&\'\202-\377])/\\$1/g; $a =~ s/[\n]/'\n'/g; # filenames with '\n' is quoted using \' } return wantarray ? @strings : "@strings"; @@ -7210,6 +7210,8 @@ sub replaced { my $regexp = join('|', map { my $s = $_; $s =~ s/(\W)/\\$1/g; $s } sort { length $b <=> length $a } keys %replace); for(@target) { + # ::debug("replace","Replace in ",::my_dump($_)); + # TODO can this be /o ? s/($regexp)/join(" ",@{$replace{$1}})/ge; } } @@ -7287,8 +7289,9 @@ sub new { # Add {} if no replacement strings in @command ($replacecount_ref, $len_ref, @command) = replacement_counts_and_lengths(@command); - if("@command" =~ /^\S*\257