Skip Menu |

This queue is for tickets about the Devel-MAT CPAN distribution.

Report information
The Basics
Id: 100458
Status: resolved
Priority: 0/
Queue: Devel-MAT

People
Owner: Nobody in particular
Requestors: SREZIC [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in:
  • 0.18
  • 0.19
Fixed in: 0.21



Subject: Test suite fails with perl 5.21.4 and newer
Probably you're aware of it, but anyway ... see http://matrix.cpantesters.org/?dist=Devel-MAT%200.19
On Wed Nov 19 16:49:24 2014, SREZIC wrote: Show quoted text
> Probably you're aware of it, but anyway ... see > http://matrix.cpantesters.org/?dist=Devel-MAT%200.19
Ooh, I wasn't previously aware of that, no Can't locate object method "stashname" via package "Devel::MAT::SV::REF" at /tmp/loop_over_bdir-31439-uGCLvY/Devel-MAT-0.19-PN4jCm/blib/lib/Devel/MAT/SV.pm line 1394. Well that looks excitingly nontrivial :( -- Paul Evans
On Wed Nov 19 17:01:57 2014, PEVANS wrote: Show quoted text
> On Wed Nov 19 16:49:24 2014, SREZIC wrote:
> > Probably you're aware of it, but anyway ... see > > http://matrix.cpantesters.org/?dist=Devel-MAT%200.19
> > Ooh, I wasn't previously aware of that, no > > Can't locate object method "stashname" via package > "Devel::MAT::SV::REF" at /tmp/loop_over_bdir-31439-uGCLvY/Devel-MAT- > 0.19-PN4jCm/blib/lib/Devel/MAT/SV.pm line 1394. > > Well that looks excitingly nontrivial :(
Just guessing based on the class name, I suspect it was the change that made ‘sub foo{}’ store a sub ref in the stash that broke this. So it’s probably actually unexcitingly trivial to fix. :-)
v5.21.3-654-ga65cc14 is the commit where bisect stops. The relevant bleadperl ticket was https://rt.perl.org/rt3/Ticket/Display.html?id=122857
On Tue Nov 25 14:48:30 2014, ANDK wrote: Show quoted text
> v5.21.3-654-ga65cc14 is the commit where bisect stops. The relevant > bleadperl ticket was > https://rt.perl.org/rt3/Ticket/Display.html?id=122857
commitdiff is: http://perl5.git.perl.org/perl.git/commitdiff/a65cc14?hp=230b3caa7e7f84ecf3fa68999603884d4b196166 I can't immediately see from that what the issue should be and how to fix it. I suspect this commit isn't the actual change, but one related to it. The code that this error in invoking is: .... package Devel::MAT::SV::CODE; 1390 sub name 1391 { 1392 my $self = shift; 1393 return unless my $glob_at = $self->glob_at; 1394 return '&' . $self->df->sv_at( $glob_at )->stashname; 1395 } Failing to call ->stashname on an SV::REF suggests that the SV it finds in the CvGV slot isn't, in fact, a GV after all, but an SV with SvROK. Am currently in the process of 'perlbrew'ing myself a 5.21.4 -- Paul Evans
The code in the failing test starts off 14 sub inner { 15 Devel::MAT::Dumper::dump( $DUMPFILE ) # l0 + 1 16 } Then later on tries to inspect this CV. Inspecting this in the GTK explorer leads me to find that the CvGV slot of this CV seems to point directly at an SV with SvROK. The SvRV of that points directly back at this CV. I can't seem to find a GV itself that would hold the name of this sub. What's going on there? -- Paul Evans
It would appear the actual culprit is: http://perl5.git.perl.org/perl.git/commit/f9d9e965c This patch claims that: • CvGV now reifies the GV if necessary. but my observation here is that they aren't in the case of Devel::MAT. The relevant code in the Dumper is at https://metacpan.org/source/PEVANS/Devel-MAT-0.19/lib/Devel/MAT/Dumper.xs#L476 -- Paul Evans
On Thu Dec 04 12:32:14 2014, PEVANS wrote: Show quoted text
> It would appear the actual culprit is: > > http://perl5.git.perl.org/perl.git/commit/f9d9e965c > > This patch claims that: > > • CvGV now reifies the GV if necessary. > > but my observation here is that they aren't in the case of Devel::MAT. > The relevant code in the Dumper is at > > https://metacpan.org/source/PEVANS/Devel-MAT- > 0.19/lib/Devel/MAT/Dumper.xs#L476
On Thu Dec 04 12:08:04 2014, PEVANS wrote: Show quoted text
> Inspecting this in the GTK explorer leads me to find that the CvGV > slot of this CV seems to point directly at an SV with SvROK. The SvRV > of that points directly back at this CV. I can't seem to find a GV > itself that would hold the name of this sub. > > What's going on there?
I think that by the time CvGV reifies the GV, you have already recorded the RV that you followed to get to it. Since it is the RV itself that gets upgraded to a typeglob, referential identity results in a CvGV pointing to the RV. So, either you can check, when you have a sub ref, whether CvGV(SvRV(ref)) modifies ref, before dumping it (may be problematic if you have already processed a reference to that RV); or you could check !CvNAMED(cv) before processing CvGV, to avoid vivifying anything during the dump.
On Fri Dec 05 09:28:54 2014, SPROUT wrote: Show quoted text
> I think that by the time CvGV reifies the GV, you have already > recorded the RV that you followed to get to it. Since it is the RV > itself that gets upgraded to a typeglob, referential identity results > in a CvGV pointing to the RV. > > So, either you can check, when you have a sub ref, whether > CvGV(SvRV(ref)) modifies ref, before dumping it (may be problematic if > you have already processed a reference to that RV); or you could check > !CvNAMED(cv) before processing CvGV, to avoid vivifying anything > during the dump.
So my code is now: if(!CvNAMED(cv)) write_svptr(fh, (SV*)CvGV(cv)); else write_svptr(fh, NULL); And unfortunately I'm still getting CV "glob" slots that claim to point directly to REFs. This is the only occurrence of CvGV in the code. More specifically, throughout the entire memory dump, the only two CVs I can find with these odd glob slots are normal named functions defined in the main script; every single function that appears in the symbol table from other files has a proper GV. This is even true of nontrivially-small programs - if I load half of IO::Async, for example, then again every single CV in the IO::Async:: and below namespace appears to have a real GV in its CvGV slot; not a single function is found without one. In case it is of interest, the program that can create these odd CVs is https://metacpan.org/source/PEVANS/Devel-MAT-0.20/t/02contexts.t What is notable about those functions is that both of them are "live" on the callstack at the time the heap is dumped; though the same can also be said for the (XS) heap dumping function itself; and that retains a perfectly normal GV in this file. I remain confused. -- Paul Evans
I think this one is fixed now. -- Paul Evans