Bug in perl v5.8.5 Built for sun4-solaris. Any patch availabale?

G

Gancy

Hello All,

Today I have posted a question regrdaing a core dump issue. I did more
investigation on this and I found some more information.

1. I have a HPUX 11i box and the perl version and other information is
as follows:
*******************************************************
This is perl, v5.6.1 built for PA-RISC1.1-thread-multi
(with 1 registered patch, see perl -V for more detail)

Copyright 1987-2001, Larry Wall

Binary build 633 provided by ActiveState Corp.
http://www.ActiveState.com
Built 21:04:57 Jun 17 2002


Perl may be copied only under the terms of either the Artistic License
or the
GNU General Public License, which may be found in the Perl 5 source
kit.
******************************************************

With this version of perl I DONT see core dump problem. But with the
perl which I have on my SunOS box, I do see core dump.

*******************************************************
This is perl, v5.8.5 built for sun4-solaris

Copyright 1987-2004, Larry Wall

Perl may be copied only under the terms of either the Artistic License
or the
GNU General Public License, which may be found in the Perl 5 source
kit.

Complete documentation for Perl, including FAQ lists, should be found
on
this system using `man perl' or `perldoc perl'. If you have access to
the
Internet, point your browser at http://www.perl.com/, the Perl Home
Page.
********************************************************

Here is the stack trace:

[24376] S_regmatch(0x0, 0x128468, 0x1, 0x117400, 0x11a000,
0xffffffff), at 0xd4934
[24377] S_regmatch(0x0, 0x128460, 0x0, 0x117400, 0x11a000,
0xffffffff), at 0xd4934
[24378] S_regmatch(0x0, 0x128450, 0x0, 0x117400, 0x11a000,
0xffffffff), at 0xd4934
[24379] S_regmatch(0x0, 0x128438, 0x0, 0x117400, 0x11a000,
0xffffffff), at 0xd4714
[24380] S_regtry(0x1283c8, 0x16288b, 0x12e531, 0x18cf56, 0x18cf57,
0x1627ef), at 0xd0a78
[24381] Perl_regexec_flags(0x1283c8, 0x1627ef, 0x18cf55, 0x161da0,
0x0, 0x16288b), at 0xd0554
[24382] Perl_pp_match(0x1283c8, 0x12d878, 0x100, 0x12d878, 0x18cf65,
0x13), at 0x819e4
[24383] Perl_runops_standard(0x117400, 0x1223e0, 0x127420, 0x0,
0x11ff94, 0x0), at 0x7de70
[24384] S_run_body(0x1, 0x117c00, 0x117c00, 0x0, 0xffbefa4c, 0x3), at
0x28490
[24385] perl_run(0x0, 0xfffffffc, 0x3, 0xffbefa3c, 0x0, 0x0), at
0x280c0
[24386] main(0x3, 0xffbefa3c, 0xffbefa4c, 0x1176a8, 0x0, 0x0), at
0x24e34

Has anyone faced similar problem?? If any patch is available then
please let me know.

******************************
My previous question was....

Here is the snipet of the perl script, I have perl version v5.8.5 built
for sun4-solaris. I have run this script on thousands of 'c','C++'
headers and source files. Runs smoothly as my new ESTEEM car. But i
have one surce file toke.c in my test case. soon this scripts hits this
file at it dumps. I have tried and still trying to debug, but still no
solutions. If anybody can help me with this would be of great
appreciation. I can uploaded source file (toke.c) as well as core file
frames(core), if needed.


#!/usr/bin/perl


$np = qr{
\(
(?:
(?>[^()]+ )
|
(??{ $np })
)*
\)


}x;


$funpat = qr/((\W)?(\*?\*?\w+)\s*($np))/;
my $temp;


open (FILE, "toke.c") || die "Cannot open file";


while($temp = <FILE>)
{
$tstring.=$temp;


}


close FILE;


get_fn_call($tstring);


sub get_fn_call($){
my ($cur_str) = @_;
while( $cur_str =~ m/$funpat/g )
{
$4 =~ /^\(((.*\n*.*)*)\)$/;
get_fn_call($1);


}
}

Thanks
-Ganesh
 
A

Anno Siegel

Gancy said:
Hello All,

Today I have posted a question regrdaing a core dump issue. I did more
investigation on this and I found some more information.
[snip]

Has anyone faced similar problem?? If any patch is available then
please let me know.

******************************
My previous question was....

Here is the snipet of the perl script, I have perl version v5.8.5 built
for sun4-solaris. I have run this script on thousands of 'c','C++'
headers and source files. Runs smoothly as my new ESTEEM car. But i
have one surce file toke.c in my test case. soon this scripts hits this
file at it dumps. I have tried and still trying to debug, but still no
solutions. If anybody can help me with this would be of great
appreciation. I can uploaded source file (toke.c) as well as core file
frames(core), if needed.


#!/usr/bin/perl


$np = qr{
\(
(?:
(?>[^()]+ )
|
(??{ $np })
)*
\)


}x;


$funpat = qr/((\W)?(\*?\*?\w+)\s*($np))/;
my $temp;


open (FILE, "toke.c") || die "Cannot open file";


while($temp = <FILE>)
{
$tstring.=$temp;


}


close FILE;


get_fn_call($tstring);


sub get_fn_call($){
my ($cur_str) = @_;
while( $cur_str =~ m/$funpat/g )
{
$4 =~ /^\(((.*\n*.*)*)\)$/;
get_fn_call($1);


}
}

That's a horrible little program.

Recursive regexes are fun, but should probably not be used in production
code. In particular, note that the /(??{ code })/ construct is still
experimental, which means that bugs must be expected.

The regex recursion seems to go out of control on toke.c. You can watch this
after the following modification to the definitions of $np and $funpat:

our $count;
my $np;
$np = qr{
\(
(?:
(?>[^()]+ )
|
(??{ $count ++; print "recurs $count\n"; $np })
)*
\)
}x;

use re 'eval';
my $funpat = qr/(?{ $count = 0 })((\W)?(\*?\*?\w+)\s*($np))/;

With other files, the count in recurs stays below 10 or so. With toke.c,
it counts up until something breaks. That looks like an error in the
definition of $np (I'm not debugging this any further). The bug in
Perl is that it doesn't recognize deep regex recursion. That could
presumably be demonstrated by a simpler program.

If you want to file a bug, write that simple demonstration. If you want
your program to run on toke.c, fix the regex, it's wrong.

If you want your program to be solid code, rewrite it from scratch,
probably based on Text::Balanced.

Anno
 
A

Anno Siegel

Gancy said:
Hello All,

Today I have posted a question regrdaing a core dump issue. I did more
investigation on this and I found some more information.
[snip]

Has anyone faced similar problem?? If any patch is available then
please let me know.

******************************
My previous question was....

Here is the snipet of the perl script, I have perl version v5.8.5 built
for sun4-solaris. I have run this script on thousands of 'c','C++'
headers and source files. Runs smoothly as my new ESTEEM car. But i
have one surce file toke.c in my test case. soon this scripts hits this
file at it dumps. I have tried and still trying to debug, but still no
solutions. If anybody can help me with this would be of great
appreciation. I can uploaded source file (toke.c) as well as core file
frames(core), if needed.


#!/usr/bin/perl


$np = qr{
\(
(?:
(?>[^()]+ )
|
(??{ $np })
)*
\)


}x;


$funpat = qr/((\W)?(\*?\*?\w+)\s*($np))/;
my $temp;


open (FILE, "toke.c") || die "Cannot open file";


while($temp = <FILE>)
{
$tstring.=$temp;


}


close FILE;


get_fn_call($tstring);


sub get_fn_call($){
my ($cur_str) = @_;
while( $cur_str =~ m/$funpat/g )
{
$4 =~ /^\(((.*\n*.*)*)\)$/;
get_fn_call($1);


}
}

That's a horrible little program. Whoever wrote it must have been high
on recursion. The first time I saw it, I just averted my eyes.

Recursive regexes are fun but should probably not be used in production
code. In particular note that the /(??{ code })/ construct is still
experimental, which means that bugs must be expected.

The regex recursion seems to go out of control on toke.c. You can watch this
after the following modification to the definitions of $np and $funpat:

our $count;
my $np;
$np = qr{
\(
(?:
(?>[^()]+ )
|
(??{ $count ++; print "recurs $count\n"; $np })
)*
\)
}x;

use re 'eval';
my $funpat = qr/(?{ $count = 0 })((\W)?(\*?\*?\w+)\s*($np))/;

With other files, the count in recurs stays below 10 or so. With toke.c,
it counts up until something breaks. That looks like an error in the
definition of $np (I'm not debugging this any further). The bug in
Perl is that it doesn't recognize deep regex recursion. That could
presumably be demonstrated by a simpler program.

If you want to file a bug, write that simple demonstration. If you want
your program to run on toke.c, fix the regex, it's wrong.

If you want your program to be solid code, rewrite it from scratch,
probably based on Text::Balanced.

Anno
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,567
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top