develooper Front page | perl.perl5.porters | Postings from April 2006

Re: [perl #33936] segment fault when using split() in regexp with (??{...})

Thread Previous | Thread Next
From:
Dominic Dunlop
Date:
April 2, 2006 12:15
Subject:
Re: [perl #33936] segment fault when using split() in regexp with (??{...})
Message ID:
AD104FE7-2BD6-49B6-A845-46458179A4B1@computer.org
[A pretty late reply, this ...]

On 2005–02–08, at 13:45, hv@crypt.org wrote:

> Rafael Garcia-Suarez <rgarciasuarez@mandrakesoft.com> wrote:
> :王晓哲 wrote:
> :> When using split() function in (??{...}), the Perl interpreter  
> died.
> :> This error can be verified by the following program:
> :> #!/usr/bin/perl
> :> $a="aba";
> :> print "matched\n" if $a=~/(??{"aba"})/;	# OK
> :> print "matched\n" if $a=~/(??{join("",split("","aba"))})/; #  
> Segmentation Fault
> :
> :The regexp engine not being reentrant, this is not expected to work.
> :However, the segfault seems to occur only with threaded perls.
>
FWIW, I get a bus error on both threaded and unthreaded bleadperl,  
although I can make the error go away if the last line is

print "matched\n" if $a=~/(??{join(m% *%,split("x","aba"))})/;

Having tried other re-entrant things, it's just the luck of the draw  
whether and how they blow up. It's all unsafe.

> Just for the record, as far as I'm concerned the regexp engine is  
> supposed
> to be reentrant, so this is only "not expected to work" until we  
> fix those
> bugs.

Belatedly, and until that happy day comes, I attach a documentation  
patch to describe this limitation.
-- 
Dominic Dunlop


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About