develooper Front page | perl.perl5.porters | Postings from May 2013

[perl #117917] Bug in Regex-Engine (?)

Thread Previous | Thread Next
James E Keenan via RT
May 9, 2013 01:14
[perl #117917] Bug in Regex-Engine (?)
Message ID:
On Wed May 08 13:36:33 2013, wrote:
> I am not sure, whether perlbug correctly sent this or not. Sorry, if 
> this is duplicate content to you.
> The attached file is the bugreport, that I (hope) I just sent. If so, 
> ignore this mail please.

The program as I have extracted it from your attachment:

$ cat 
use strict;
use warnings;

use re "debugcolor"; 

sub getDel {
          my $z = shift;
          die $z;
          return ')' if $z eq '(';
          return '>' if $z eq '<';
          return ']' if $z eq '[';
          return '}' if $z eq '{';
          return $z;

'qq"hello"' =~ /(?<stringstart>(?:q(?:[xwrq])?\s*)?)(?<delim>(??{
(exists ($+{stringstart}) && $+{stringstart} =~ m#q#) ? q#"|'# : '\\w'
})).*?(?<!\\)(??{ die $+{delim}; defined $1 ? quotemeta(getDel($1)) :
'(?!)' })/

When I run this with 'use re "debugcolor";' commented out, I get this:

$ perl 
Use of uninitialized value $+{"delim"} in die at (re_eval 2) line 1.
Died at (re_eval 2) line 1.

When I activate 'use re "debugcolor";', the program ends with a bus
error (see attachment).

Now, I have never actually used named captures in regular expressions,
nor have I ever used 'use re' anything.  So I can't claim to say
anything about the possible interaction of these features.

But if this were my program I'd deal *first* with the warning and error
message thrown when you run without 'debugcolor'.  I would then try to
build up the pattern match in small pieces, with and without
'debugcolor'.  The objective would be to determine what tips the program
into a segfault or bus error.

I don't see any evidence yet that there is a problem with the Perl 5
core distribution, which is the subject of this mailing list.  You might
be better off taking this problem first to a place such as  If discussion there points to the Perl 5 regex engine as
the problem -- as distinct from use of that engine -- then we could
resume discussion here.

My two cents.

Thank you very much.
Jim Keenan

via perlbug:  queue: perl5 status: new

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About