Subject: Re: bug#22181: endless loop in grep 2.22

From: Jim Meyering <[email-masked]>
Date: Fri, 8 Jan 2016 17:01:45 -0800

On Fri, Jan 8, 2016 at 1:32 PM, Jim Meyering <[email-masked]> wrote:
> On Fri, Jan 8, 2016 at 8:50 AM, Paul Eggert <[email-masked]> wrote:
>> On 01/07/2016 09:47 PM, Jim Meyering wrote:
>>>
>>> FAIL: encoding-error
>>> ====================
>>> ...
>>> --- exp 2016-01-07 21:39:42.018646618 -0800
>>> +++ out 2016-01-07 21:39:42.018646618 -0800
>>> @@ -1 +1 @@
>>> -Binary file in matches
>>> +Pedro P\xe9rez
>>> + fail=1
>>
>>
>> I can't reproduce that in Fedora 23 x86-64, which is using gcc 5.3.1
>> 20151207 (Red Hat 5.3.1-2).
>>
>> One hypothetical explanation is a bug or incompatibility in the
>> bleeding-edge Debian shell, which I suppose could cause
>> require_en_utf8_locale_ to do the wrong thing (i.e., to fail to report that
>> the en_US.UTF-8 locale is missing). You might check the output of the
>> command './get-mb-cur-max en_US.UTF-8' when you have the time.
>
> Will investigate. In the mean time, here's a patch for the
> false-positive failure I mentioned:

It was trivial: printf does not necessarily support \xHH hexadecimal
escapes. I switched the input generation to use printf with an octal
escaped byte instead, and now it works.

I've just pushed the attached along with the preceding patch.
From 8eb72603aec2007f990f9ff196310b2eea662c6b Mon Sep 17 00:00:00 2001
From: Jim Meyering <[email-masked]>
Date: Fri, 8 Jan 2016 16:56:50 -0800
Subject: [PATCH] tests: fix encoding-error test failure to use of printf
 '\xHH'

* tests/encoding-error: Don't rely on printf having support for \xHH
hexadecimal.  That is not portable.  Use \OOO octal, instead.

maint: fix typo in NEWS: s/a/an/
---
 tests/encoding-error | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/encoding-error b/tests/encoding-error
index 2f09c21..4b5fcb5 100755
--- a/tests/encoding-error
+++ b/tests/encoding-error
@@ -16,7 +16,7 @@ export LC_ALL

 printf 'Alfred Jones\n' > a || framework_failure_
 printf 'John Smith\n' >j || framework_failure_
-printf 'Pedro P\xe9rez\n' >p || framework_failure_
+printf 'Pedro P\351rez\n' >p || framework_failure_
 cat a p j >in || framework_failure_

 fail=0
-- 
2.6.4