[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#16586: bug#17245: GREP BUG: grep -P and binary files

From: Jim Meyering
Subject: bug#16586: bug#17245: GREP BUG: grep -P and binary files
Date: Wed, 23 Apr 2014 19:30:46 -0700

On Mon, Apr 21, 2014 at 11:03 AM, Paul Eggert <address@hidden> wrote:
> On 04/16/2014 05:13 AM, Norihiro Tanaka wrote:
>> http://bugs.exim.org/show_bug.cgi?id=1468
> Thanks.  The response there makes it clear that if grep passes arbitrary
> binary data to PCRE, and if grep uses PCRE_NO_UTF8_CHECK, undefined behavior
> will result (maybe infinite loop, core dump, etc.).  We can't have undefined
> behavior in grep.  A simple fix is to avoid using PCRE_NO_UTF8_CHECK so I
> installed the attached patch to do that.  Perhaps we can think of a better
> way at some point.  In the meantime I'm taking the liberty of closing
> Bug#17245 and Bug#16586.

Thanks for the patch, but I'm not sure I like the consequences:
that anyone using grep -P to search data that is even a tiny bit
inconsistent with their UTF-8 locale will now get an exit status of
2 rather than the matches they used to get. I would prefer to test for
working PCRE support and disable -P if it is deemed inadequate,
but that may have to wait for the release of a new version of

In any case, I found that this additional change is required,
at least on OS/X, to avoid a test failure:

Attachment: k.txt
Description: Text document

reply via email to

[Prev in Thread] Current Thread [Next in Thread]