develooper Front page | perl.perl5.porters | Postings from November 2003

Re: 5.8.2 coredump: tied hashes implemented as XSUB methods

Thread Previous | Thread Next
From:
Yitzchak Scott-Thoennes
Date:
November 17, 2003 05:22
Subject:
Re: 5.8.2 coredump: tied hashes implemented as XSUB methods
Message ID:
20031117132223.GA1860@efn.org
On Mon, Nov 17, 2003 at 01:18:33PM +0000, Alan Burlison <Alan.Burlison@sun.com> wrote:
> >I have a module (Solaris::Kstat) which implements a tied hash entirely 
> >from XSUB code.  This works fine in 5.6.1, but cores in 5.8.2.
> 
> I've done a bit more digging, and this is failing because in 5.6.1 I was 
> setting the keys & values of the tied hashes to be readonly, and this has 
> clashed with the way the 'Restricted hash' functionality introduced 
> post-5.6.1 which also uses the READONLY flags.  The implementation of 
> restricted hashes isn't exactly clearly documented on perlguts, so I 
> haven't yet figured out exactly what I am doing wrong.  I'm 
> setting/unsetting READONLY on the hashes themselves, and on the entries 
> returned by hv_fetch(), but obviously this isn't correct.  I'm getting the 
> SEGV in Perl_hv_clear, here:
> 
>         I32 i;
>         HE* entry;
>         for (i = 0; i <= (I32) xhv->xhv_max; i++) {
> --->         entry = ((HE**)xhv->xhv_array)[i];
> 
> because xhv->xhv_array is NULL - I have no idea why yet.  Can anyone shed 
> any light on exactly how the READONLY flags are supposed to be set to get 
> the various restricted hash behaviours?

My memory is that they used the READONLY flag on the hashes to
indicate a restricted hash only after checking that it had no current
meaning.  If that memory is correct, setting it on the HVs in 5.6.1
was a noop.  Did you find that it had any effect?

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