From 29cd838eab01ed7110f3ccb2e8c6a35c8a31dbcc Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Thu, 11 Apr 2024 10:21:29 +0200 Subject: Adding upstream version 1:0.1.9998svn3589+dfsg. Signed-off-by: Daniel Baumann --- src/grep/tests/invalid-multibyte-infloop | 37 ++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100755 src/grep/tests/invalid-multibyte-infloop (limited to 'src/grep/tests/invalid-multibyte-infloop') diff --git a/src/grep/tests/invalid-multibyte-infloop b/src/grep/tests/invalid-multibyte-infloop new file mode 100755 index 0000000..b4ad14b --- /dev/null +++ b/src/grep/tests/invalid-multibyte-infloop @@ -0,0 +1,37 @@ +#!/bin/sh +# Ensure that we don't trigger a grep -F infloop. + +. "${srcdir=.}/init.sh"; path_prepend_ ../src + +require_en_utf8_locale_ +require_compiled_in_MB_support +require_timeout_ + +encode() { echo "$1" | tr A '\202'; } + +encode AA > input + +fail=0 + +# Before 2.15, this would infloop. +LC_ALL=en_US.UTF-8 timeout 10 grep -aF $(encode A) input > out +status=$? +if test $status -eq 0; then + compare input out +elif test $status -eq 1; then + compare_dev_null_ /dev/null out +else + test $status -eq 2 +fi || fail=1 + +LC_ALL=en_US.UTF-8 timeout 10 grep -F $(encode A) input > out +status=$? +if test $status -eq 0; then + compare /dev/null out +elif test $status -eq 1; then + compare_dev_null_ /dev/null out +else + test $status -eq 2 +fi || fail=1 + +Exit $fail -- cgit v1.2.3