Package: backuppc
Version: 3.3.1-2
Severity: normal
Tags: patch

As of Perl 5.22.0 in some cases curly brackets needs to be escaped.

More info here:

  http://perldoc.perl.org/perlre.html#Quantifiers

  "If a curly bracket occurs in any other context and does not form
  part of a backslashed sequence like \x{...} , it is treated as a
  regular character. However, a deprecation warning is raised for
  all such occurrences, and in Perl v5.26, literal uses of a curly
  bracket will be required to be escaped, say by preceding them
  with a backslash ("\{" ) or enclosing them within square brackets
  ("[{]" ). This change will allow for future syntax extensions
  (like making the lower bound of a quantifier optional),
   and better error checking of quantifiers.

/usr/share/backuppc/lib/BackupPC/Lib.pm contains such braces in
regexp that throw warnings like:

  Unescaped left brace in regex is deprecated, passed through in
  regex; marked by <-- HERE in m/\${ <-- HERE (\w+)}(\+?)/
  at /usr/share/backuppc/lib/BackupPC/Lib.pm line 1269.

  Unescaped left brace in regex is deprecated, passed through in
  regex; marked by <-- HERE in m/(.*)\${ <-- HERE (\w+)}(\+?)(.*)/
  at /usr/share/backuppc/lib/BackupPC/Lib.pm line 1274.

patch attached.

Marcel
--- /usr/share/backuppc/lib/BackupPC/Lib.pm	2016-01-06 12:44:15.000000000 +0100
+++ /usr/share/backuppc/lib/BackupPC/Lib.pm	2016-04-05 16:23:35.706625290 +0200
@@ -1262,7 +1262,7 @@
         #
         # Replace scalar variables first
         #
-        $arg =~ s[\${(\w+)}(\+?)]{
+        $arg =~ s[\$\{(\w+)}(\+?)]{
             exists($vars->{$1}) && ref($vars->{$1}) ne "ARRAY"
                 ? ($2 eq "+" ? $bpc->shellEscape($vars->{$1}) : $vars->{$1})
                 : "\${$1}$2"
@@ -1271,7 +1271,7 @@
         # Now replicate any array arguments; this just works for just one
         # array var in each argument.
         #
-        if ( $arg =~ m[(.*)\${(\w+)}(\+?)(.*)] && ref($vars->{$2}) eq "ARRAY" ) {
+        if ( $arg =~ m[(.*)\$\{(\w+)}(\+?)(.*)] && ref($vars->{$2}) eq "ARRAY" ) {
             my $pre  = $1;
             my $var  = $2;
             my $esc  = $3;

Reply via email to