Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Segmentation fault doing grep -P
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
ljgibson
n00b
n00b


Joined: 06 Nov 2004
Posts: 9
Location: Florida

PostPosted: Wed Jul 13, 2005 1:45 am    Post subject: Segmentation fault doing grep -P Reply with quote

I can consistently make grep crash on my two Gentoo machines. Would anyone be interested in trying this to see if they're getting this too?

Create a text file with a couple of lines like this:

Code:

  230  0 0.000000  58 0 0.000000
  230  1 0.000000  58 0 0.000000


(All the whitespace you see are space characters.)

Then I use grep on the file:

Code:

grep -P '^\s*\d+\s+\d+\s+0\.000000\s+\d+\s+\d+\s+0\.000000\s*$' myfile.txt


grep's output is:

Code:

  230  0 0.000000  58 0 0.000000
  230  1 0.000000  58 0 0.000000
Segmentation fault


If I remove the '$' from the pattern supplied to grep, the crash doesn't occur. However, grep -P '^.*$' myfile.txt will not cause grep -P to crash for me.

Does anyone else get results like this? Would it be appropriate to submit this to bugzilla?
Back to top
View user's profile Send private message
BitJam
Advocate
Advocate


Joined: 12 Aug 2003
Posts: 2513
Location: Silver City, NM

PostPosted: Wed Jul 13, 2005 2:27 am    Post subject: Reply with quote

I've got grep-2.5.1-r1 installed and it doesn't accept the -P option. No segfault.
Back to top
View user's profile Send private message
ljgibson
n00b
n00b


Joined: 06 Nov 2004
Posts: 9
Location: Florida

PostPosted: Wed Jul 13, 2005 2:37 am    Post subject: Reply with quote

I didn't remember to post my build information. I'm using grep 2.5.1-r7. nls and pcre use flags were set when I emerge'd grep. (I believe the pcre use flag must be set in order for grep to use perl regex's.)

I just reproduced the same crash on a RH 9 system which has version 2.5.1 of grep.
Back to top
View user's profile Send private message
limn
l33t
l33t


Joined: 13 May 2005
Posts: 997

PostPosted: Wed Jul 13, 2005 3:07 pm    Post subject: Reply with quote

Reproduced the error and clearly it is related to the anchor as you noted.
ljgibson wrote:
Would it be appropriate to submit this to bugzilla?

Probably this is an upstream bug, but perhaps you should start there.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum