summaryrefslogtreecommitdiff
path: root/testsuite/misc.pl
diff options
context:
space:
mode:
author0xddaa <0xddaa@gmail.com>2018-03-13 22:34:26 -0400
committerAssaf Gordon <assafgordon@gmail.com>2018-03-14 18:41:09 -0400
commitb5f5236a4b3a2d6c2f89fb99d614486a65a40a24 (patch)
tree346a6d79788bea7c25e32dc0289bd06e7f012c67 /testsuite/misc.pl
parentef9fcbc4cd20f30da7068981605c2c89468e9cdf (diff)
downloadsed-b5f5236a4b3a2d6c2f89fb99d614486a65a40a24.tar.gz
sed: treat '\x5c' as literal backslash
Sed incorrectly treated '\x5c' (ASCII 92, backslash) as an escape character. Old behavior: $ echo z | sed -E 's/(z)/\x5c1/' # identical to 's/(z)/\1/' z New behavior: $ echo z | sed -E 's/(z)/\x5c1/' \1 Reported in https://bugs.gnu.org/30794. * NEWS: Mention bug fix. * sed/compile.c (normalize_text): Pass backslash as literal character. * testsuite/misc.pl: Add tests.
Diffstat (limited to 'testsuite/misc.pl')
-rw-r--r--testsuite/misc.pl7
1 files changed, 7 insertions, 0 deletions
diff --git a/testsuite/misc.pl b/testsuite/misc.pl
index 92838cb..3fa5b84 100644
--- a/testsuite/misc.pl
+++ b/testsuite/misc.pl
@@ -1190,6 +1190,13 @@ s,.*[^\/],,
. "baaaacx\n"}
],
+
+ # Four backslashes (2 pairs of "\\") to pass through two interpolations:
+ # once in Perl, then the shell command line argument.
+ # sed will see one backslash character in the s/// command.
+ ['bug30794_1', "s/z/\\\\x5cA/", {IN=>'z'}, {OUT => "\\A"}],
+ ['bug30794_2', "s/z/\\\\x5c/", {IN=>'z'}, {OUT => "\\"}],
+ ['bug30794_3', "s/z/\\\\x5c1/", {IN=>'z'}, {OUT => "\\1"}],
);
my $save_temps = $ENV{SAVE_TEMPS};