This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Fix quote() function to escape backslashes but not minus signs
authorNiko Tyni <ntyni@debian.org>
Sat, 18 Apr 2015 15:59:07 +0000 (18:59 +0300)
committerTony Cook <tony@develop-help.com>
Wed, 3 Jun 2015 01:25:56 +0000 (11:25 +1000)
The delimiter character isn't special in character square brackets,
and neither is the backslash. So '\-\' means just a range of backslash
to backslash, and the minus sign isn't included at all.

Substitution tested with GNU Solaris 9 sed programs.

Originally noticed by Kristoffer Grundstr?m.

Bug-Debian: https://bugs.debian.org/754057

Makefile.SH

index ee12747..8f4fbe0 100755 (executable)
@@ -5,7 +5,7 @@
 quote() {
        case "$1" in
        '') echo "''" ;;
-       *)  echo "$1" | sed 's/\([^a-zA-Z0-9.:_\-\/]\)/\\\1/g' ;;
+       *)  echo "$1" | sed 's/\([^a-zA-Z0-9.:_/-]\)/\\\1/g' ;;
        esac
 }