GNU bug report logs - #19833
grep: internal PCRE error: -27 since updating from 2.16 to 2.21

Previous Next

Package: grep;

Reported by: Oliver Freyermuth <o.freyermuth <at> googlemail.com>

Date: Tue, 10 Feb 2015 22:15:01 UTC

Severity: normal

Done: Paul Eggert <eggert <at> cs.ucla.edu>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 19833 in the body.
You can then email your comments to 19833 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-grep <at> gnu.org:
bug#19833; Package grep. (Tue, 10 Feb 2015 22:15:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Oliver Freyermuth <o.freyermuth <at> googlemail.com>:
New bug report received and forwarded. Copy sent to bug-grep <at> gnu.org. (Tue, 10 Feb 2015 22:15:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Oliver Freyermuth <o.freyermuth <at> googlemail.com>
To: bug-grep <at> gnu.org
Subject: grep: internal PCRE error: -27 since updating from 2.16 to 2.21
Date: Tue, 10 Feb 2015 22:59:38 +0100
[Message part 1 (text/plain, inline)]
Dear grep'pers,

since I updated from 2.16 to 2.21, several of my "check list of files
for bad filenames"-style grep expressions fail like this:
grep: internal PCRE error: -27
(one of the failing examples follows at the end of the mail, example
filename-list attached)

Researching this, I found that -27 is PCRE_ERROR_JIT_STACKLIMIT.
Apparently I exceed the 512 K JIT-stack-limit which is hardcoded in grep
with several of my regexps.

As using the JIT can not be turned off at runtime, nor can the stacksize
be controlled without patching + recompiling, this breaks previously
working expressions for me, so I consider this a new regression,
introduced with b06f7a29a58bbdd5866afc1e92dba3fdc9e2ed59 .

I tested that increasing the stack-size to 1 M fixes the problem for me.
A better fix could maybe consist of a better error message, allowing
stack-size control at runtime and / or making JIT optional at runtime.


Reproducer, using the attached file (which is generated by a find
command, of course - only 637 files with absolute paths in plain ASCII):
$ LANG=C grep -P -n '^([/](?!/)|[^/])*~/.*' pcrejit.txt
grep: internal PCRE error: -27


Cheers,
	Oliver
[pcrejit.txt (text/plain, attachment)]

Reply sent to Paul Eggert <eggert <at> cs.ucla.edu>:
You have taken responsibility. (Wed, 11 Feb 2015 07:50:02 GMT) Full text and rfc822 format available.

Notification sent to Oliver Freyermuth <o.freyermuth <at> googlemail.com>:
bug acknowledged by developer. (Wed, 11 Feb 2015 07:50:03 GMT) Full text and rfc822 format available.

Message #10 received at 19833-done <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Oliver Freyermuth <o.freyermuth <at> googlemail.com>, 
 19833-done <at> debbugs.gnu.org
Subject: Re: bug#19833: grep: internal PCRE error: -27 since updating from
 2.16 to 2.21
Date: Tue, 10 Feb 2015 23:49:17 -0800
[Message part 1 (text/plain, inline)]
Thanks for the bug report and test case.  I installed the attached patch, which 
fixed the bug for me, and which adds a similar test case to the test database.
[0001-Grow-the-JIT-stack-if-it-becomes-exhausted.patch (text/x-patch, attachment)]

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 11 Mar 2015 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 9 years and 52 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.