develooper Front page | perl.perl5.porters | Postings from January 2009

[PATCH] Re: 5.10.0 regressions that need fixing

Thread Previous | Thread Next
Ben Morrow
January 5, 2009 10:35
[PATCH] Re: 5.10.0 regressions that need fixing
Message ID:
Quoth (Dave Mitchell):
> Date: Tue, 02 Sep 2008 12:33:34 -0700
> Subject: [perl #58530] Bus error with constant + overload + stash manipulation
>         + bless
>     Appears to be a 5.8.8 regression. fails on maint + bleed

The test case in the bug report is equivalent to

    sub foo { 1 }
    use overload q/""/ => \&foo;
    delete $main::{foo};
    bless [];

and deleting stashes has always been able to produce segfaults; for

    use Devel::Peek;
    my $x = \&{"foo"};
    delete $main::{foo};
    Dump $x;

which has segfaulted since at least 5.6. I don't really understand why
overloading didn't tickle this under 5.8--I suspect the glob was being
kept around when it shouldn't have been--but in any case the attached
patches fix most of this class of segfaults by making a sub CvANON when
its stash entry gets deleted.

The first is the fix, which requires regen_headers; the second is the
output of regen_headers; the third is the test cases. Clearing or
deleting an entire stash will still leave any anon subs in that stash
prone to causing segfaults, but I don't see any way of finding them.
I've included TODO tests anyway... :).


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