tests: add test for latest fix

* NEWS (Bug fixes): Describe it.
* tests/invalid-re: New test for just-fixed bug.
* tests/Makefile.am (TESTS): Add it.
This commit is contained in:
Jim Meyering 2017-05-02 19:52:37 -07:00
parent af6d2e0dbd
commit 4e40686e23
3 changed files with 25 additions and 0 deletions

6
NEWS
View File

@ -4,6 +4,12 @@ GNU diffutils NEWS -*- outline -*-
** Bug fixes
Using an invalid regular expression with --ignore-matching-lines=RE (-I)
no longer causes stack overflow. Before, with an invocation like the
following, diff would diagnose the error, but would still proceed to
blow the stack: diff -Ia -I\\ <(echo) <(echo b)
[bug introduced in 2.9]
diff no longer mishandles line numbers exceeding 2**31 on Mingw-w64.
the ---presume-output-tty (ostensibly test-only) option would cause

View File

@ -9,6 +9,7 @@ TESTS = \
diff3 \
excess-slash \
help-version \
invalid-re \
function-line-vs-leading-space \
ignore-matching-lines \
label-vs-func \

18
tests/invalid-re Executable file
View File

@ -0,0 +1,18 @@
#!/bin/sh
# Ensure we diagnose and fail upon first invalid -I regex.
. "${srcdir=.}/init.sh"; path_prepend_ ../src
fail=0
echo > a || framework_failure_
echo b > b || framework_failure_
echo 'diff: \: Trailing backslash' > exp-err || framework_failure_
# This must fail with an exit status of 2:
returns_ 2 diff -Ix -I\\ a b > out 2> err || fail=1
compare /dev/null out || fail=1
compare exp-err err || fail=1
Exit $fail