summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJim Meyering <meyering@redhat.com>2011-05-21 12:58:55 +0200
committerJim Meyering <meyering@redhat.com>2011-05-21 13:36:23 +0200
commitc079748fd59d5562633dcc11d971347c58413feb (patch)
tree0359edfb20f1d4c08a733dd8c6b4b53f0fe23f1e /tests
parent2c1a222ec4a90219486f01efcd7d1cfd2ce6d30f (diff)
downloadgrep-c079748fd59d5562633dcc11d971347c58413feb.tar.gz
grep -P: don't abort upon exceeding PCRE's backtracking limit
* src/pcresearch.c (Pexecute): Handle PCRE_ERROR_MATCHLIMIT. * tests/Makefile.am (XFAIL_TESTS): Remove pcre-abort. * tests/pcre-abort: Expect failure, no output, and increase the length of the input string, in case the backtracking limit is ever raised. Adjust comment. * NEWS (Bug fixes): Mention it.
Diffstat (limited to 'tests')
-rw-r--r--tests/Makefile.am1
-rwxr-xr-xtests/pcre-abort10
2 files changed, 6 insertions, 5 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 61098324..a01b0048 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -33,7 +33,6 @@ if USE_INCLUDED_REGEX
XFAIL_TESTS += equiv-classes
endif
XFAIL_TESTS += turkish-I
-XFAIL_TESTS += pcre-abort
TESTS = \
backref \
diff --git a/tests/pcre-abort b/tests/pcre-abort
index fd679325..131fa477 100755
--- a/tests/pcre-abort
+++ b/tests/pcre-abort
@@ -1,5 +1,6 @@
#! /bin/sh
-# Show how to make grep -P abort.
+# Show that grep handles PCRE's PCRE_ERROR_MATCHLIMIT.
+# In grep-2.8, it would abort.
#
# Copyright (C) 2011 Free Software Foundation, Inc.
#
@@ -12,8 +13,9 @@ require_pcre_
fail=0
-echo aaaaaaaaaaaaaab > in || framework_failure_
-grep -P '((a+)*)+$' in > out || fail=1
-compare in out || fail=1
+echo aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaab > in || framework_failure_
+grep -P '((a+)*)+$' in > out
+test $? = 2 || fail=1
+compare out /dev/null || fail=1
Exit $fail