diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2015-09-19 14:17:55 -0700 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2015-09-19 18:42:23 -0700 |
commit | 4f898f22f497d6296c864d17acf9b277761b4ab4 (patch) | |
tree | df5faac9baa674b7c9ec8f372e258ee7f2d54ff2 /tests/backref-alt | |
parent | 13e960b064163dfe7b776359d1a6c75574c160f9 (diff) | |
download | grep-4f898f22f497d6296c864d17acf9b277761b4ab4.tar.gz |
Add test for pop_fail_stack bug
Problem reported by Hanno Böck in: http://bugs.gnu.org/21513
If you use --with-included-regex the bug fix is in gnulib, here:
http://git.savannah.gnu.org/cgit/gnulib.git/commit/?id=5513b40999149090987a0341c018d05d3eea1272
If you use glibc, the bug fix has not been installed yet.
* tests/Makefile.am (XFAIL_TESTS): Add backref-alt if system matcher.
(TESTS): Add backref-alt.
* tests/backref-alt: New file.
* tests/triple-backref: Remove unused var.
Don't skip if tested with glibc, as Makefile.am now handles this.
Diffstat (limited to 'tests/backref-alt')
-rwxr-xr-x | tests/backref-alt | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/backref-alt b/tests/backref-alt new file mode 100755 index 00000000..d6a8f2e7 --- /dev/null +++ b/tests/backref-alt @@ -0,0 +1,27 @@ +#! /bin/sh +# Test for a bug in glibc's regex code as of 2015-09-19. +# +# Copyright 2015 Free Software Foundation, Inc. +# +# Copying and distribution of this file, with or without modification, +# are permitted in any medium without royalty provided the copyright +# notice and this notice are preserved. + +. "${srcdir=.}/init.sh"; path_prepend_ ../src + +echo aa > in || framework_failure_ + +fail=0 + +grep -E 'b|(.)b|\1|b' in >out +status=$? +# POSIX isn’t clear whether this regular expression should be invalid, +# (because the \1 is out of range for REs that could precede it) +# or valid but \1 should not match. Allow either interpretation. +test $status -eq 2 || test $status -eq 1 || fail=1 + +grep -E '0|()0|\1|0' in >out +status=$? +test $status -eq 2 || test $status -eq 1 || fail=1 + +Exit $fail |