Arch Linux

Please read this before reporting a bug:
https://wiki.archlinux.org/title/Bug_reporting_guidelines

Do NOT report bugs when a package is just outdated, or it is in the AUR. Use the 'flag out of date' link on the package page, or the Mailing List.

REPEAT: Do NOT report bugs for outdated packages!
Tasklist

FS#37556 - grep 2.15-1 dumps core with -P

Attached to Project: Arch Linux
Opened by Nathan Trapuzzano (nbtrap) - Wednesday, 30 October 2013, 15:27 GMT
Last edited by Allan McRae (Allan) - Thursday, 02 January 2014, 06:40 GMT
Task Type Bug Report
Category Packages: Core
Status Closed
Assigned To Allan McRae (Allan)
Architecture All
Severity Medium
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Description:

Running grep with -P dumps core, usually after printing some matches.

Steps to reproduce:

grep -P foo -r $HOME
This task depends upon

Closed by  Allan McRae (Allan)
Thursday, 02 January 2014, 06:40 GMT
Reason for closing:  Fixed
Additional comments about closing:  grep-2.16 in [testing]
Comment by Dave Reisner (falconindy) - Wednesday, 30 October 2013, 16:11 GMT
Poking around a debugger shows that pcre_exec returns PCRE_ERROR_BADUTF{8,16,32} which is essentially unhandled by grep (calls abort()).

bisecting...
Comment by Dave Reisner (falconindy) - Wednesday, 30 October 2013, 16:18 GMT
First bad commit: 67436786c110bbb565f0c1b96f1ca1d4586e1c8d

It seems that this commit forces utf-8 validation for all content in the search, so anything non-conforming (which you very likely encounter in a large enough search), aborts grep. trivial patch attached to at least start a conversation.
Comment by Dave Reisner (falconindy) - Wednesday, 30 October 2013, 18:45 GMT
I filed a bug report upstream which was "acknowledged". I have no idea where it actually is, since the grep project makes it unnecessarily hard for non-developers to post bugs.
Comment by Christian Neukirchen (chneukirchen) - Saturday, 09 November 2013, 15:41 GMT
Minimal test case:

printf "\370" | grep -P x

Setting LC_ALL=C for grep helps avoid this bug in the mean time.
Comment by Dave Reisner (falconindy) - Saturday, 09 November 2013, 15:53 GMT
Sure, or you can call grep -P on any binary file.

Upstream bug report: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=15758
Comment by Paul Bredbury (brebs) - Sunday, 24 November 2013, 14:19 GMT Comment by Dave Reisner (falconindy) - Sunday, 24 November 2013, 14:22 GMT
No, it isn't a full fix. See my reply on the upstream bug report explaining that it's still suboptimal behavior (and upstream agreeing):

http://debbugs.gnu.org/cgi/bugreport.cgi?bug=15758#19
Comment by Allan McRae (Allan) - Saturday, 21 December 2013, 23:47 GMT
Patches now decided upon in upstream. But new release expected in a few days, so I will wait rather than backporting.

Loading...