grep-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

grep branch, master, updated. v3.1-44-g2725f1e


From: Jim Meyering
Subject: grep branch, master, updated. v3.1-44-g2725f1e
Date: Sat, 24 Nov 2018 22:01:08 -0500 (EST)

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "grep".

The branch, master has been updated
       via  2725f1ee63e60da75a3884bcd6363ef6dbe9a39f (commit)
      from  30e666ca22eaa7e69330ca46201e40f1cdb0f41e (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit/grep.git/commit/?id=2725f1ee63e60da75a3884bcd6363ef6dbe9a39f


commit 2725f1ee63e60da75a3884bcd6363ef6dbe9a39f
Author: Jim Meyering <address@hidden>
Date:   Sat Nov 24 12:17:05 2018 -1000

    tests: stack-overflow: avoid false failure
    
    * tests/stack-overflow: This test would fail to elicit a stack overflow
    diagnostic on some OS X systems. Rewrite to iterate, gradually increasing
    the size of the input regex, stopping when grep emits the desired diagnostic
    or the size reaches a reasonable limit.

diff --git a/tests/stack-overflow b/tests/stack-overflow
index 2042ebc..6922045 100755
--- a/tests/stack-overflow
+++ b/tests/stack-overflow
@@ -3,14 +3,23 @@
 
 . "${srcdir=.}/init.sh"; path_prepend_ ../src
 
-# Too many open parentheses.
-printf %080000d 0|tr 0 '(' > in || framework_failure_
 echo grep: stack overflow > exp || framework_failure_
 
+# grep attempts to detect overflow via gnulib's c-stack module.
+# Trigger that with an input regex composed solely of open parentheses,
+# increasing the size of that input until grep emits the expected diagnostic.
 fail=0
-returns_ 2 grep -E -f in >out 2>err || fail=1
+for i in 1 3 5 10 20 30 40 50 100 200; do
+  # Create a file containing $i * 10000 open parentheses:
+  printf %0${i}0000d 0|tr 0 '(' > in || framework_failure_
+  grep -E -f in >out 2>err; st=$?
+  if grep -q 'stack overflow' err; then
+    test $st = 2 || fail=1
+    compare /dev/null out || fail=1
+    compare exp err || fail=1
+    test $fail = 0 && Exit 0
+    fail_ 'printed "stack overflow", but something else was wrong'
+  fi
+done
 
-compare /dev/null out || fail=1
-compare exp err || fail=1
-
-Exit $fail
+fail_ 'grep never printed "stack overflow"'

-----------------------------------------------------------------------

Summary of changes:
 tests/stack-overflow | 23 ++++++++++++++++-------
 1 file changed, 16 insertions(+), 7 deletions(-)


hooks/post-receive
-- 
grep



reply via email to

[Prev in Thread] Current Thread [Next in Thread]