develooper Front page | perl.perl5.porters | Postings from July 2016

[perl #128532] Crash with Symbol::delete_package and subref

Thread Previous
From:
Father Chrysostomos
Date:
July 4, 2016 01:11
Subject:
[perl #128532] Crash with Symbol::delete_package and subref
Message ID:
rt-4.0.18-30591-1467594692-698.128532-75-0@perl.org
# New Ticket Created by  Father Chrysostomos 
# Please include the string:  [perl #128532]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org/Ticket/Display.html?id=128532 >


>From <577975CB.2080006@alexbyk.com>:

$ perl  -MSymbol -E 'Symbol::delete_package "My::Foo"; \&My::Foo::foo;'
Segmentation fault

Bisect:

186a5ba82d5844e9713475c494fcd6682968609f is the first bad commit
commit 186a5ba82d5844e9713475c494fcd6682968609f
Author: Father Chrysostomos <sprout@cpan.org>
Date:   Wed Jun 13 22:46:40 2012 -0700

    Don’t create pads for sub stubs
    
    Two code paths, sv_2cv (for \&name) and get_cvn_flags (for
    &{"name"}()) were using start_subparse and newATTRSUB to create a
    subroutine stub, which is what usually happens for Perl subs (with
    op trees).
    
    This resulted in subs with unused pads attached to them, because
    start_subparse sets up the pad, which must be accessible dur-
    ing parsing.
    
    One code path, gv_init, which (among other things) reifies a GV after
    a sub declaration (like ‘sub foo;’, which for efficiency doesn’t
    create a CV), created the subroutine stub itself, without using
    start_subparse/newATTRSUB.
    
    This commit takes the code from gv_init, makes it more generic so it
    can apply to the other two cases, puts it in a new function called
    newSTUB, and makes all three locations call it.
    
    Now stub creation should be faster and use less memory.
    
    Additionally, this commit causes sv_2cv and get_cvn_flags to bypass
    bug #107370 (glob stringification not round-tripping properly).  They
    used to stringify the GV and pass the string to newATTRSUB (wrapped in
    an op, of all things) for it to look up the GV again.  While bug
    been fixed, as it was a side effect of sv_2cv triggering bug #107370.

-- 

Father Chrysostomos


Thread Previous


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