buggrep - Bugs: bug #12368, Segfault with grep -P

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #12368: Segfault with grep -P

Submitted by:  None
Submitted on:  Fri 18 Mar 2005 07:33:46 PM UTC  
 
Category: NoneSeverity: 3 - Normal
Item Group: NoneStatus: Fixed
Privacy: PublicAssigned to: None
Open/Closed: Closed

Thu 05 Jun 2008 08:07:28 AM UTC, comment #4:

I managed to connect to the cvs. Yes, my case is fixed, too.
Sorry for the inconvenience, but you have another test case now ;-)

Torsten Will <towi>
Thu 05 Jun 2008 08:02:28 AM UTC, comment #3:

Yep, I had the same. I have not tried CVS version (my ssh refuses to connect to the server, maybe ssh-key-bug?), so for the sake of completeness...
Here is a test case, I hope it helps:

$ cat xx | pgrep -P -o "(\\S+) \\| ((\\d+\\.\\d+)) \\| \\s+(\\d+\\.\\d+) \\| ([^. =]+)\\.([^ =]+) ?= ?\"?([^\"]*)\"?"
xmwc-stgt-de02 | 1212589022.737232 | 0.373311 | ifDescr.67 = "GigabitEthernet3/15"
Segmentation fault

$ cat xx
--- should match ---
xmwc-stgt-de02 | 1212589022.737232 | 0.373311 | ifDescr.67 = "GigabitEthernet3/15"
l3shr-gts2-de02 | 1208524225.403611 | 0.129490 | ltmVirtualAddrStatClientBytesOut.1.4.195.71.128.36 = 12810964
rslv-mnch-de01 | 1212589021.659283 | 0.033502 | ifOutOctets.1249 = 947353
rslv-mnch-de01 | 1212589021.659283 | 0.033502 | ifOutOctets.1250 = 1250573

--- do not have to match ---
ro2e-mnch-de02 | 1212589045.270488 | 22.789715 | ifDescr = Timed out
ro2e-mnch-de02 | 1212589045.270755 | 22.779856 | ifOutOctets = Timed out
[[[EOF]]]

(I installed this version as "pgrep")

$ pgrep --version
grep (GNU grep) 2.5

machine: ubuntu hardy, intel 64bit.
$ uname -a
Linux havaloc 2.6.24-17-generic #1 SMP Thu May 1 13:57:17 UTC 2008 x86_64 GNU/Linux

$ grep -3 MAJ /usr/include/pcre.h

/* The current PCRE version information. */

#define PCRE_MAJOR 7
#define PCRE_MINOR 4
#define PCRE_PRERELEASE
#define PCRE_DATE 2007-09-21

Torsten Will <towi>
Mon 11 Apr 2005 09:55:05 PM UTC, comment #2:

I am closing this bug, as the seg-fault is fixed in CVS. If Perl regular expressions don't work quite as they should, that's a separate bug.

Julian Foad <julianfoad>
Fri 18 Mar 2005 11:26:09 PM UTC, comment #1:

Hello,

this problem has been partly addressed (see bug #4531 for description and separate patch).

The newest CVS version includes the fix, so check it out.
It avoids the segfault, but you might still not get the results you expect in some cases.

The -P option continues to be an experimental feature, whose shortcomings will be addressed in future releases of grep.

Claudio

Claudio Fontana <sick_soul>
Fri 18 Mar 2005 07:33:46 PM UTC, original submission:

I got a seg fault while doing some routine greping. Since I don't start using a large amount of memory, I figure this is not the sort of bug that was warned about in the man page.

The original command I ran was:

cat ~/segFault.list | grep -P '^\.\/[^/]+\/[^/]+$'

However, I've narrowed it down to
grep -P '[^/]*'
(or grep -P '[^/]+'
or grep -P '[^/]{2,}
etc)
None of these do quite what I would expect them to in perl.

grep --version yields:
grep (GNU grep) 2.5.1

System: Fedora Core 3 (or Core 2)
Bash: GNU bash, version 3.00.14(1)-release (i386-redhat-linux-gnu)

Reproduced on a number of different machines (all running grep 2.5.1)...sorry this is the only version I have access to.

If I missed something important that needs to be known...just ask.

Manfred

Anonymous

 

Attached Files
file #2748:  segFault.list added by None (17KiB - application/octet-stream - original input for crashing grep)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by towi (Posted a comment)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 3 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Mon 11 Apr 2005 09:55:05 PM UTCjulianfoadStatusNone=>Fixed
      Open/ClosedOpen=>Closed
    Fri 18 Mar 2005 07:33:46 PM UTCNoneAttached File-=>Added segFault.list, #2325

    Back to the top


    Powered by Savane 3.1-cleanup1