summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordds <dds@FreeBSD.org>2009-09-20 15:47:31 +0000
committerdds <dds@FreeBSD.org>2009-09-20 15:47:31 +0000
commit5ce4473a063068c7ec01f5ef5465d2375fa65ce9 (patch)
tree9476a172ce6dab91adaa99623975642aeb2827b5
parent668711df00c430313df2e249177f681be4ccdf02 (diff)
downloadFreeBSD-src-5ce4473a063068c7ec01f5ef5465d2375fa65ce9.zip
FreeBSD-src-5ce4473a063068c7ec01f5ef5465d2375fa65ce9.tar.gz
IEEE Std 1003.1, 2004 Edition states:
"The escape sequence '\n' shall match a <newline> embedded in the pattern space." It is unclear whether this also applies to a \n embedded in a character class. Disable the existing handling of \n in a character class following Mac OS X, GNU sed version 4.1.5 with --posix, and SunOS 5.10 /usr/bin/sed. Pointed by: Marius Strobl Obtained from: Mac OS X
-rw-r--r--tools/regression/usr.bin/sed/multitest.t3
-rw-r--r--tools/regression/usr.bin/sed/regress.multitest.out/8.222
-rw-r--r--tools/regression/usr.bin/sed/regress.multitest.out/8.231
-rw-r--r--usr.bin/sed/compile.c3
4 files changed, 7 insertions, 2 deletions
diff --git a/tools/regression/usr.bin/sed/multitest.t b/tools/regression/usr.bin/sed/multitest.t
index 9322078..67dcded 100644
--- a/tools/regression/usr.bin/sed/multitest.t
+++ b/tools/regression/usr.bin/sed/multitest.t
@@ -449,6 +449,9 @@ u2/g' lines1
mark '8.21'
echo 'a\b(c' |
$SED 'y%ABCDEFGHIJKLMNOPQRSTUVWXYZ, /\\()"%abcdefghijklmnopqrstuvwxyz,------%'
+ COMMENT='\n in a character class and a BRE'
+ mark '8.22' ; (echo 1; echo 2) | $SED -n '1{;N;s/[\n]/X/;p;}'
+ mark '8.23' ; (echo 1; echo 2) | $SED -n '1{;N;s/\n/X/;p;}'
}
test_error()
diff --git a/tools/regression/usr.bin/sed/regress.multitest.out/8.22 b/tools/regression/usr.bin/sed/regress.multitest.out/8.22
new file mode 100644
index 0000000..1191247
--- /dev/null
+++ b/tools/regression/usr.bin/sed/regress.multitest.out/8.22
@@ -0,0 +1,2 @@
+1
+2
diff --git a/tools/regression/usr.bin/sed/regress.multitest.out/8.23 b/tools/regression/usr.bin/sed/regress.multitest.out/8.23
new file mode 100644
index 0000000..c66dd65
--- /dev/null
+++ b/tools/regression/usr.bin/sed/regress.multitest.out/8.23
@@ -0,0 +1 @@
+1X2
diff --git a/usr.bin/sed/compile.c b/usr.bin/sed/compile.c
index 1db7f63..cea8e07 100644
--- a/usr.bin/sed/compile.c
+++ b/usr.bin/sed/compile.c
@@ -432,8 +432,7 @@ compile_ccl(char **sp, char *t)
for (c = *s; (*t = *s) != ']' || c != d; s++, t++)
if ((c = *s) == '\0')
return NULL;
- } else if (*s == '\\' && s[1] == 'n')
- *t = '\n', s++;
+ }
return (*s == ']') ? *sp = ++s, ++t : NULL;
}
OpenPOWER on IntegriCloud