Skip Menu |
 

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

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

Report information
The Basics
Id: 68225
Status: resolved
Priority: 0/
Queue: Devel-Cover

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

Bug Information
Severity: Important
Broken in: 0.77
Fixed in: (no value)



Subject: Devel::Cover crashes on overloaded method that creates closure
Download (untitled) / with headers
text/plain 1.6k
Dear Paul, thanks for developing Devel::Cover. I have run into a problem which I reduced to the following minimal code example: -------- #!perl package My::Package; use base Class::Accessor; __PACKAGE__->mk_ro_accessors('foo'); sub make_ro_accessor { return sub { my $self = shift; }; } 1; package main; use Devel::Cover; -------- The script fails with the following message: perl: B.c:3919: XS_B__PV_PVX: Assertion `!((((_svpvx)->sv_flags & (0x00004000|0x00008000)) == 0x00008000) && (((svtype)((_svpvx)->sv_flags & 0xff)) == SVt_PVGV || ((svtype)((_svpvx)->sv_flags & 0xff)) == SVt_PVLV))' failed. The method make_ro_accessor (don't confuse it with mk_ro_accessors which is called by the script and then calls make_ro_accessor) overloads the corresponding method in Class::Accessor. The only "special" thing I can think of is that the base method creates and returns a closure. I use Class::Accessor version 0.34. It's version of make_ro_accessor is printed below. Note that the problem does not occur if I comment out line 10 ("my $self = shift") of the above script such that the method just returns an empty anonymous subroutine. I am reporting this bug as broken in version 0.77 (which I just confirmed), but I ran into it using version 0.76. Best wishes Lutz Appendix: Class::Accessor::make_ro_accessor -------- sub make_ro_accessor { my($class, $field) = @_; return sub { my $self = shift; if (@_) { my $caller = caller; $self->_croak("'$caller' cannot alter the value of '$field' on objects of class '$class'"); } else { return $self->get($field); } }; }
Download (untitled) / with headers
text/plain 5.4k
On Mon May 16 02:05:51 2011, LGEHLEN wrote: Show quoted text
> Dear Paul, > thanks for developing Devel::Cover. I have run into a problem which I > reduced to the following minimal code example: > > -------- > > #!perl > > package My::Package; > use base Class::Accessor; > > __PACKAGE__->mk_ro_accessors('foo'); > > sub make_ro_accessor { > return sub { > my $self = shift; > }; > } > > 1; > > package main; > use Devel::Cover; > > -------- > > The script fails with the following message: > perl: B.c:3919: XS_B__PV_PVX: Assertion `!((((_svpvx)->sv_flags & > (0x00004000|0x00008000)) == 0x00008000) && (((svtype)((_svpvx)->sv_flags > & 0xff)) == SVt_PVGV || ((svtype)((_svpvx)->sv_flags & 0xff)) == > SVt_PVLV))' failed. > > The method make_ro_accessor (don't confuse it with mk_ro_accessors which > is called by the script and then calls make_ro_accessor) overloads the > corresponding method in Class::Accessor. The only "special" thing I can > think of is that the base method creates and returns a closure. I use > Class::Accessor version 0.34. It's version of make_ro_accessor is > printed below. > > Note that the problem does not occur if I comment out line 10 ("my $self > = shift") of the above script such that the method just returns an empty > anonymous subroutine. > > I am reporting this bug as broken in version 0.77 (which I just > confirmed), but I ran into it using version 0.76. > > Best wishes > Lutz > > > Appendix: Class::Accessor::make_ro_accessor > -------- > sub make_ro_accessor { > my($class, $field) = @_; > > return sub { > my $self = shift; > > if (@_) { > my $caller = caller; > $self->_croak("'$caller' cannot alter the value of '$field' > on objects of class '$class'"); > } > else { > return $self->get($field); > } > }; > }
I am unable to reproduce this bug. ########## $ cat accessor.pl package My::Package; use base Class::Accessor; __PACKAGE__->mk_ro_accessors('foo'); sub make_ro_accessor { return sub { my $self = shift; }; } 1; package main; use Devel::Cover; $ perl accessor.pl Devel::Cover 1.00: Collecting coverage data for branch, condition, pod, statement, subroutine and time. Selecting packages matching: Ignoring packages matching: /Devel/Cover[./] Ignoring packages in: /usr/local/lib/perl5/site_perl/5.16.0/darwin-2level /usr/local/lib/perl5/site_perl/5.16.0 /usr/local/lib/perl5/5.16.0/darwin-2level /usr/local/lib/perl5/5.16.0 /usr/local/lib/perl5/site_perl/5.14.2 /usr/local/lib/perl5/site_perl/5.14.0 /usr/local/lib/perl5/site_perl/5.12.0 /usr/local/lib/perl5/site_perl/5.10.1 /usr/local/lib/perl5/site_perl/5.10.0 /usr/local/lib/perl5/site_perl Devel::Cover: Writing coverage database to /Users/jimk/Documents/AAAPerl/Devel-Cover/68825/cover_db/runs/1365772083.573.08819 ---------------------------- ------ ------ ------ ------ ------ ------ ------ File stmt bran cond sub pod time total ---------------------------- ------ ------ ------ ------ ------ ------ ------ accessor.pl 0.0 n/a n/a 0.0 n/a n/a 0.0 Total 0.0 n/a n/a 0.0 n/a n/a 0.0 ---------------------------- ------ ------ ------ ------ ------ ------ ------ $ cover -report=text Reading database from /Users/jimk/Documents/AAAPerl/Devel-Cover/68825/cover_db ---------------------------- ------ ------ ------ ------ ------ ------ ------ File stmt bran cond sub pod time total ---------------------------- ------ ------ ------ ------ ------ ------ ------ accessor.pl 0.0 n/a n/a 0.0 n/a n/a 0.0 Total 0.0 n/a n/a 0.0 n/a n/a 0.0 ---------------------------- ------ ------ ------ ------ ------ ------ ------ Run: accessor.pl Perl version: 5.16.0 OS: darwin Start: Fri Apr 12 13:08:03 2013 Finish: Fri Apr 12 13:08:03 2013 accessor.pl line err stmt bran cond sub pod time code 1 package My::Package; 2 use base Class::Accessor; 3 4 *** 0 __PACKAGE__->mk_ro_accessors('foo'); 5 6 sub make_ro_accessor { 7 *** 0 0 return sub { my $self = shift; }; *** 0 0 8 } 9 10 *** 0 1; 11 12 package main; 13 use Devel::Cover; 14 Uncovered Subroutines --------------------- Subroutine Count Location ---------------- ----- ------------- foo 0 accessor.pl:7 make_ro_accessor 0 accessor.pl:7 ########## In other words, while I don't get very meaningful results, I don't get any crash. I recommend that this ticket be closed. Thank you very much. Jim Keenan
Download (untitled) / with headers
text/plain 5.6k
Hi Jim, thanks for looking into this. I cannot reproduce the problem on my current system either. I am going to close the ticket. Thanks, Lutz On Fri Apr 12 09:10:56 2013, JKEENAN wrote: Show quoted text
> On Mon May 16 02:05:51 2011, LGEHLEN wrote:
> > Dear Paul, > > thanks for developing Devel::Cover. I have run into a problem which
> I
> > reduced to the following minimal code example: > > > > -------- > > > > #!perl > > > > package My::Package; > > use base Class::Accessor; > > > > __PACKAGE__->mk_ro_accessors('foo'); > > > > sub make_ro_accessor { > > return sub { > > my $self = shift; > > }; > > } > > > > 1; > > > > package main; > > use Devel::Cover; > > > > -------- > > > > The script fails with the following message: > > perl: B.c:3919: XS_B__PV_PVX: Assertion `!((((_svpvx)->sv_flags & > > (0x00004000|0x00008000)) == 0x00008000) && (((svtype)((_svpvx)- > >sv_flags > > & 0xff)) == SVt_PVGV || ((svtype)((_svpvx)->sv_flags & 0xff)) == > > SVt_PVLV))' failed. > > > > The method make_ro_accessor (don't confuse it with mk_ro_accessors
> which
> > is called by the script and then calls make_ro_accessor) overloads
> the
> > corresponding method in Class::Accessor. The only "special" thing I
> can
> > think of is that the base method creates and returns a closure. I
> use
> > Class::Accessor version 0.34. It's version of make_ro_accessor is > > printed below. > > > > Note that the problem does not occur if I comment out line 10 ("my
> $self
> > = shift") of the above script such that the method just returns an
> empty
> > anonymous subroutine. > > > > I am reporting this bug as broken in version 0.77 (which I just > > confirmed), but I ran into it using version 0.76. > > > > Best wishes > > Lutz > > > > > > Appendix: Class::Accessor::make_ro_accessor > > -------- > > sub make_ro_accessor { > > my($class, $field) = @_; > > > > return sub { > > my $self = shift; > > > > if (@_) { > > my $caller = caller; > > $self->_croak("'$caller' cannot alter the value of
> '$field'
> > on objects of class '$class'"); > > } > > else { > > return $self->get($field); > > } > > }; > > }
> > > I am unable to reproduce this bug. > > ########## > $ cat accessor.pl > package My::Package; > use base Class::Accessor; > > __PACKAGE__->mk_ro_accessors('foo'); > > sub make_ro_accessor { > return sub { my $self = shift; }; > } > > 1; > > package main; > use Devel::Cover; > > $ perl accessor.pl > Devel::Cover 1.00: Collecting coverage data for branch, condition, > pod, statement, subroutine and time. > Selecting packages matching: > Ignoring packages matching: > /Devel/Cover[./] > Ignoring packages in: > /usr/local/lib/perl5/site_perl/5.16.0/darwin-2level > /usr/local/lib/perl5/site_perl/5.16.0 > /usr/local/lib/perl5/5.16.0/darwin-2level > /usr/local/lib/perl5/5.16.0 > /usr/local/lib/perl5/site_perl/5.14.2 > /usr/local/lib/perl5/site_perl/5.14.0 > /usr/local/lib/perl5/site_perl/5.12.0 > /usr/local/lib/perl5/site_perl/5.10.1 > /usr/local/lib/perl5/site_perl/5.10.0 > /usr/local/lib/perl5/site_perl > Devel::Cover: Writing coverage database to > /Users/jimk/Documents/AAAPerl/Devel- > Cover/68825/cover_db/runs/1365772083.573.08819 > ---------------------------- ------ ------ ------ ------ ------ ------ > ------ > File stmt bran cond sub pod time > total > ---------------------------- ------ ------ ------ ------ ------ ------ > ------ > accessor.pl 0.0 n/a n/a 0.0 n/a n/a > 0.0 > Total 0.0 n/a n/a 0.0 n/a n/a > 0.0 > ---------------------------- ------ ------ ------ ------ ------ ------ > ------ > > > $ cover -report=text > Reading database from /Users/jimk/Documents/AAAPerl/Devel- > Cover/68825/cover_db > > > ---------------------------- ------ ------ ------ ------ ------ ------ > ------ > File stmt bran cond sub pod time > total > ---------------------------- ------ ------ ------ ------ ------ ------ > ------ > accessor.pl 0.0 n/a n/a 0.0 n/a n/a > 0.0 > Total 0.0 n/a n/a 0.0 n/a n/a > 0.0 > ---------------------------- ------ ------ ------ ------ ------ ------ > ------ > > > Run: accessor.pl > Perl version: 5.16.0 > OS: darwin > Start: Fri Apr 12 13:08:03 2013 > Finish: Fri Apr 12 13:08:03 2013 > > accessor.pl > > line err stmt bran cond sub pod time code > 1 package > My::Package; > 2 use base > Class::Accessor; > 3 > 4 *** 0 __PACKAGE__-
> >mk_ro_accessors('foo');
> 5 > 6 sub > make_ro_accessor { > 7 *** 0 0 return sub { > my $self = shift; }; > *** 0 0 > 8 } > 9 > 10 *** 0 1; > 11 > 12 package main; > 13 use > Devel::Cover; > 14 > > > Uncovered Subroutines > --------------------- > > Subroutine Count Location > ---------------- ----- ------------- > foo 0 accessor.pl:7 > make_ro_accessor 0 accessor.pl:7 > > ########## > > In other words, while I don't get very meaningful results, I don't get > any crash. > > I recommend that this ticket be closed. > > Thank you very much. > Jim Keenan


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.