[perl #72740]: Blead breaks LEMBARK/LinkedList-Single-0.99.1.tar.gz
authorZefram <zefram@fysh.org>
Wed, 10 Mar 2010 19:53:50 +0000 (19:53 +0000)
committerDavid Mitchell <davem@iabyn.com>
Wed, 10 Mar 2010 19:53:50 +0000 (19:53 +0000)
commit2867cdbcac19071f99ab71a81d63dbd894cebd3b
treeed7fbfd744985d87350aa1395d7334d1fde26872
parentab8e66c141d8d7d892995deba69405e747204cf0
[perl #72740]: Blead breaks LEMBARK/LinkedList-Single-0.99.1.tar.gz

f7461760003db2ce68155c97ea6c1658e96fcd27 improved the PL_check hook for
bareword subs, but broke the above module. This is Zefram's followup:

The issue is that speculative function lookups were leaving detritus
consisting of empty GVs in the stash.  These didn't affect normal
functioning, but code that looks inside the stash could see them, and
code that makes unreliable assumptions about the format of the stash
can be broken.  This is the same general mode of failure that we saw
with namespace::clean.

LinkedList-Single's failing test was using direct stash access poorly,
in a way that made for a poor test, quite apart from making too many
assumptions about stash structure.  In the latest version of the package,
0.99.6, the test has been changed to a much better form, which actually
tests what it meant to and incidentally doesn't read the stash at all.

Although they don't affect normal functioning, the empty GVs shouldn't
be there.  It's much like the upgraded constant subs, which we concluded
ought to be downgraded when the upgraded form is no longer required,
in order to save memory.  The solution here is similar: delete the
empty GV when it is detected that a real GV is no longer required.
The present patch does this at the same time as checking for constant-sub
downgradability.
gv.c
t/op/gv.t