Perl 5.8.8 segfaulting on comments! How can this be?
Andy Wardley
abw at wardley.org
Fri Dec 12 16:38:07 GMT 2008
I've got a *very* strange problem with Perl segfaulting seemingly at
random, but quite predictably based on things that it really shouldn't
care about (like comments).
It's so weird that my first thought was that it was faulty memory in my
machine. But I've tried it on two machines (both macs) and see the same
problem. I would appreciate it if some other people could verify the
problem and/or throw any light on it. There's a small (< 1k) tgz here
containing the files:
http://wardley.org/perl/broken_glass.tgz
I should mention that this problem only manifests itself on 5.8.8,
and 5.10 seems fine (haven't tried it on any other versions). However,
it is soooo weird that it's quite possible that I'm just not tickling
it right on 5.10. Of course, it might have been identified and specifically
fixed for 5.10, but I can't see any mention of it on perlbug (although I
didn't look *really* hard).
It's at the point now where deleting or changing a word in a *comment*
is the difference between it segfaulting or not.
Here's my script:
use strict;
use warnings;
use lib qw( . );
use Glass;
Here's the Glass.pm module:
package Glass;
use Broken
hello => {
foo => 1,
foo => 2,
foo => 3,
...etc... all the way to...
foo => 61,
foo => 62,
foo => qr//, # change this to 63 and it works!
foo => 64,
};
Here's the Broken.pm module. It does absolutely nothing at all other
than print a message. It just contains a load of comments.
package Broken;
# The next line is repeated 56 times in total.
# foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo
(followed by another 55 lines of foo)
print "Got to the end of the Broken.pm module";
1;
If I delete one of those comment lines, then the program stops segfaulting.
In fact, I can delete the final 'foo' on the last line and it works, put it
back in and it segfaults again.
If I change that qr// in the Glass module to the number 63 then it works OK.
If I move the qr// line up a line, down a line, or to indeed to any other
line, then it works OK. If I add a line or remove a line, then it works fine.
The fact that there are 64 entries in the hash is suspicious, although
they've all got the same key, so there's only actually 1.
Before I go digging deeper (having already lost most of the afternoon to
this), can someone confirm the problem for me?
Cheers
A
More information about the london.pm
mailing list