diff options
author | Jim Meyering <meyering@fb.com> | 2018-12-20 20:54:26 -0800 |
---|---|---|
committer | Jim Meyering <meyering@fb.com> | 2018-12-20 21:23:11 -0800 |
commit | 799ce52011f81607bb2d8aba357112a8682a4118 (patch) | |
tree | 09cbec4586ad16a4b2cc578af74cfac3d3389892 /testsuite | |
parent | 04eef69746dcf9949fabe46f70b7ad271620f442 (diff) | |
download | sed-799ce52011f81607bb2d8aba357112a8682a4118.tar.gz |
sed: fix \b DFA-bug in C locale
Under some conditions, \b would mistakenly fail to match. E.g.,
this would mistakenly print "123-x" instead of "123":
echo 123-x|LC_ALL=C sed 's/.\bx//'
* NEWS (Bug fixes): Mention it
* gnulib: Update to latest, for DFA regression fix.
* testsuite/word-delim.sh: New file, to test for the dfa.c regression.
* testsuite/local.mk (T): Add it.
Reported by Jan Palus in
https://lists.gnu.org/r/sed-devel/2018-12/msg00022.html
Diffstat (limited to 'testsuite')
-rw-r--r-- | testsuite/local.mk | 1 | ||||
-rwxr-xr-x | testsuite/word-delim.sh | 19 |
2 files changed, 20 insertions, 0 deletions
diff --git a/testsuite/local.mk b/testsuite/local.mk index 8213b06..43623bf 100644 --- a/testsuite/local.mk +++ b/testsuite/local.mk @@ -112,6 +112,7 @@ T += testsuite/8bit.sh \ testsuite/stdin.sh \ testsuite/utf8-ru.sh \ testsuite/uniq.sh \ + testsuite/word-delim.sh \ testsuite/xemacs.sh TESTS = $(SEDTESTS) $(T) diff --git a/testsuite/word-delim.sh b/testsuite/word-delim.sh new file mode 100755 index 0000000..ade3137 --- /dev/null +++ b/testsuite/word-delim.sh @@ -0,0 +1,19 @@ +#!/bin/sh +# Exercise the DFA regression in sed-4.6. +. "${srcdir=.}/testsuite/init.sh"; path_prepend_ ./sed +print_ver_ sed + +require_en_utf8_locale_ + +# Also ensure that this works in both the C locale and that multibyte one. +# In the C locale, it failed due to a dfa.c regression in sed-4.6. +echo 123-x > in || framework_failure_ +echo 123 > exp || framework_failure_ + +for locale in C en_US.UTF-8; do + LC_ALL=$locale sed 's/.\bx//' in > out 2>err || fail=1 + compare exp out || fail=1 + compare /dev/null err || fail=1 +done + +Exit $fail |