GNU bug report logs -
#15759
regression in grep 2.15 with PCRE searches
Previous Next
Reported by: Dave Reisner <d <at> falconindy.com>
Date: Wed, 30 Oct 2013 17:40:06 UTC
Severity: normal
Merged with 15758
Done: Jim Meyering <jim <at> meyering.net>
Bug is archived. No further changes may be made.
Full log
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
Hi,
A user reported a regression in grep 2.15 which is easily reproducible
as ``grep -P foo /bin/mount''. The root cause is that pcre_exec is
returning PCRE_ERROR_BADUTF8 when the current locale supports UTF-8.
This is unhandled by grep and causes it to call abort().
I bisected the breakage to commit 67436786c110bb which essentially
introduces UTF-8 validation for all searched data. In a large number of
file hierarchies, one may easily hit this via a recursive search.
I crafted the following inline diff which fixes the problem. While I'm
not sure of its correctness, it at least describes one possible fix.
diff --git a/src/pcresearch.c b/src/pcresearch.c
index ad5999d..ce55ab3 100644
--- a/src/pcresearch.c
+++ b/src/pcresearch.c
@@ -176,6 +176,9 @@ Pexecute (char const *buf, size_t size, size_t *match_size,
switch (e)
{
case PCRE_ERROR_NOMATCH:
+#ifdef HAVE_LANGINFO_CODESET
+ case PCRE_ERROR_BADUTF8:
+#endif
return -1;
case PCRE_ERROR_NOMEMORY:
Cheers,
Dave
This bug report was last modified 11 years and 123 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.