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

Re: [perl #68192] Tied scalar numeric FETCH corruption afterSTORE()ing a reference

Thread Previous | Thread Next
From:
Dave Mitchell
Date:
May 17, 2010 04:03
Subject:
Re: [perl #68192] Tied scalar numeric FETCH corruption afterSTORE()ing a reference
Message ID:
20100517110341.GC3049@iabyn.com
On Sun, May 16, 2010 at 12:00:55PM -0700, Father Chrysostomos wrote:
>
> On Jan 17, 2010, at 2:26 PM, Father Chrysostomos wrote:
>
>>
>> On Dec 13, 2009, at 12:58 PM, Father Chrysostomos wrote:
>>
>>>
>>> On Nov 15, 2009, at 1:05 PM, Father Chrysostomos wrote:
>>>
>>>> This is a regression in perl 5.10.0, caused by 
>>>> http://perl5.git.perl.org/perl.git/commitdiff/800401ee2a8a5a67ef478227b68426cf701d0116 
>>>> . The attached patch fixes this. I’m not sure whether what I’ve  
>>>> done to sv_2nv is correct. Could someone please review it?
>>>
>>> Attached is the same patch, updated for 5.11.3.
>>
>> Updated for 5.11.4.
>
> OK, let’s try this again:
>
> sv_2num doesn’t take get-magic into account, so a tied scalar containing 
> a reference is not treated as tied, at least not by numeric ops.
>
> In trying to fix this, I found that most ops check for overloading  
> before get-magic, which causes the wrong overload methods to be used.  
> Fixing this problem fixes the original bug ‘for free’, so I followed  
> this approach.

Urgh. I've just spent the last week working in a similar area, although
I've been working and making all overloadable ops respect magic, not just
numeric ones. I've also been reorganising things to reduce the binary and
size and make things faster. I'm not sure yet how much overlap there is
between our two efforts :-(. I'll look into this soon.

-- 
Hofstadter's Law: It always takes longer than you expect, even when you
take into account Hofstadter's Law.

Thread Previous | Thread Next


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