| 1 |
#!/bin/sh |
| 2 |
# These would fail (i.e., match erroneously) prior to grep-2.11. |
| 3 |
. "${srcdir=.}/init.sh"; path_prepend_ ../src |
| 4 |
|
| 5 |
xp1=4294967297 # 2^32+1 |
| 6 |
xp2=4294967298 # 2^32+2 |
| 7 |
|
| 8 |
fail=0 |
| 9 |
|
| 10 |
# Before grep-2.11, when DFA-matching, a repetition count exceeding the |
| 11 |
# range of "unsigned int" would silently wrap around. Hence, 2^32+1 |
| 12 |
# would be treated just like "1", and both of these would mistakenly match. |
| 13 |
|
| 14 |
echo abc | returns_ 2 grep -E "b{$xp1}" > out 2> /dev/null || fail=1 |
| 15 |
compare /dev/null out || fail=1 |
| 16 |
echo abbc | returns_ 2 grep -E "b{1,$xp2}" > out 2> /dev/null || fail=1 |
| 17 |
compare /dev/null out || fail=1 |
| 18 |
|
| 19 |
Exit $fail |