develooper Front page | perl.perl5.porters | Postings from December 2010

[perl #19135] string eval turns off readonlyness on lexicals

Thread Previous
From:
Father Chrysostomos via RT
Date:
December 8, 2010 11:39
Subject:
[perl #19135] string eval turns off readonlyness on lexicals
Message ID:
rt-3.6.HEAD-17624-1291837172-1169.19135-15-0@perl.org
On Mon Dec 06 07:40:09 2010, davem wrote:
> On Sun, Nov 28, 2010 at 01:39:18PM -0800, Father Chrysostomos via RT
wrote:
> > On Sun Sep 26 12:46:49 2010, sprout wrote:
> > > On Sun Sep 19 12:10:11 2010, sprout wrote:
> > > > The readonliness is turned off explicitly in pad_free under
ithreads.
> > > >    See also bug #19022, which resulted from the same change.
There is
> > > >    some discussion there, too, but nobody seemed to know exactly why
> > > >    the readonliness needed to be turned off.
> > > > 
> > > > Change 4761/2aa1bed, from January of 2000, added that
SvREADONLY_off.
> > > >    It is supposed to make sure that pad entries that were constants
> > > >    will not be constants the next time they are used.
> > > > 
> > > > My question is: When the addresses of those scalars are reused,
won’t
> > > >    the scalars be wiped clean? (In case it’s not obvious, I have
very
> > > >    little idea how pads actually work.)
> > > > 
> > > > I tried simply deleting that SvREADONLY_off, and all tests pass (see
> > > >    the first attached patch).
> > > > 
> > > > Then I thought that maybe I should check that the SV is freed, and
> > > >    only then do SvREADONLY_off, to preserve the original intent of
> > > >    change 4761/2aa1bed. That worked too.
> > > > 
> > > > So, here are two patches. Take your pick.
> > > 
> > > Has anyone in the know had a chance to review these yet?
> > 
> > Well...? :-)
> > 
> > Here is a better test case, with no Internals:: stuff:
> > 
> > $ perl5.13.5 -wle 'for my $k(!0) { eval "\$k"; eval { $k = 7 }; print
> > "a"=~/a/ }'
> > 7
> 
> I think the first fix is correct (just removing the SvREADONLY_off).

I’ve just applied a slightly modified version as 3aadd5c.



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