source: trunk/src/grep/tests/invalid-multibyte-infloop@ 3533

Last change on this file since 3533 was 3529, checked in by bird, 4 years ago

Imported grep 3.7 from grep-3.7.tar.gz (sha256: c22b0cf2d4f6bbe599c902387e8058990e1eee99aef333a203829e5fd3dbb342), applying minimal auto-props.

  • Property svn:executable set to *
File size: 746 bytes
Line 
1#!/bin/sh
2# Ensure that we don't trigger a grep -F infloop.
3
4. "${srcdir=.}/init.sh"; path_prepend_ ../src
5
6require_en_utf8_locale_
7require_compiled_in_MB_support
8require_timeout_
9
10encode() { echo "$1" | tr A '\202'; }
11
12encode AA > input
13
14fail=0
15
16# Before 2.15, this would infloop.
17LC_ALL=en_US.UTF-8 timeout 10 grep -aF $(encode A) input > out
18status=$?
19if test $status -eq 0; then
20 compare input out
21elif test $status -eq 1; then
22 compare_dev_null_ /dev/null out
23else
24 test $status -eq 2
25fi || fail=1
26
27LC_ALL=en_US.UTF-8 timeout 10 grep -F $(encode A) input > out
28status=$?
29if test $status -eq 0; then
30 compare /dev/null out
31elif test $status -eq 1; then
32 compare_dev_null_ /dev/null out
33else
34 test $status -eq 2
35fi || fail=1
36
37Exit $fail
Note: See TracBrowser for help on using the repository browser.