Skip Menu |
 

This queue is for tickets about the rpm-build-perl CPAN distribution.

Report information
The Basics
Id: 104885
Status: open
Priority: 0/
Queue: rpm-build-perl

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

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



From: gregoa [...] cpan.org
Subject: FTBFS with perl 5.22
Download (untitled) / with headers
text/plain 2.6k
We have the following bug reported to the Debian package of rpm-build-perl (https://bugs.debian.org/787461): It doesn't seem to be a bug in the packaging, so you may want to take a look. Thanks! ------8<-----------8<-----------8<-----------8<-----------8<----- Source: libb-perlreq-perl Version: 0.82-3 Severity: important User: debian-perl@lists.debian.org Usertags: perl-5.22-transition This package FTBFS with perl 5.22: PERL_DL_NONLAZY=1 "/usr/bin/perl" "-MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef *Test::Harness::Switches; test_harness(1, 'blib/lib', 'blib/arch')" t/*.t dying at -e line 1 at /«PKGBUILDDIR»/blib/lib/B/PerlReq.pm line 388. B::PerlReq::__ANON__("Can't locate object method \"sv\" via package \"B::METHOP\" at /b"...) called at /«PKGBUILDDIR»/blib/lib/B/Walker.pm line 25 B::Walker::const_sv(B::METHOP=SCALAR(0xdec5e8)) called at /«PKGBUILDDIR»/blib/lib/B/PerlReq.pm line 307 B::PerlReq::grok_entersub(B::UNOP=SCALAR(0xdec5b8)) called at /«PKGBUILDDIR»/blib/lib/B/Walker.pm line 56 B::Walker::walk_root(B::UNOP=SCALAR(0xdec5b8)) called at /«PKGBUILDDIR»/blib/lib/B/Walker.pm line 65 B::Walker::walk_root(B::LISTOP=SCALAR(0xdec528)) called at /«PKGBUILDDIR»/blib/lib/B/Walker.pm line 65 B::Walker::walk_root(B::LISTOP=SCALAR(0xd00550)) called at /«PKGBUILDDIR»/blib/lib/B/Walker.pm line 65 B::Walker::walk_root(B::UNOP=SCALAR(0xd00778)) called at /«PKGBUILDDIR»/blib/lib/B/Walker.pm line 91 B::Walker::walk_cv(B::CV=SCALAR(0xe01830)) called at /«PKGBUILDDIR»/blib/lib/B/Walker.pm line 77 B::Walker::walk_av("BEGIN", B::AV=SCALAR(0xaf21f8)) called at /«PKGBUILDDIR»/blib/lib/B/Walker.pm line 97 B::Walker::walk_blocks() called at /«PKGBUILDDIR»/blib/lib/B/PerlReq.pm line 390 B::PerlReq::__ANON__() called at (eval 2) line 31 O::CHECK() called at -e line 0 eval {...} called at -e line 0 Can't locate object method "sv" via package "B::METHOP" at /«PKGBUILDDIR»/blib/lib/B/Walker.pm line 25. CHECK failed--call queue aborted. dying at -e line 1 ... Test Summary Report ------------------- t/01-B-PerlReq.t (Wstat: 9984 Tests: 78 Failed: 39) Failed tests: 1, 4, 20-48, 52-56, 74, 77-78 Non-zero exit status: 39 t/02-perlreq.t (Wstat: 256 Tests: 4 Failed: 1) Failed test: 2 Non-zero exit status: 1 Files=3, Tests=112, 8 wallclock secs ( 0.06 usr 0.02 sys + 5.34 cusr 1.02 csys = 6.44 CPU) Result: FAIL Cheers, Dominic. ------8<-----------8<-----------8<-----------8<-----------8<----- Thanks for considering, gregor herrmann, Debian Perl Group
From: ppisar [...] redhat.com
Download (untitled) / with headers
text/plain 3.3k
Dne Út 02.čen.2015 16:33:11, GREGOA napsal(a): Show quoted text
> This package FTBFS with perl 5.22: > > PERL_DL_NONLAZY=1 "/usr/bin/perl" "-MExtUtils::Command::MM" "- > MTest::Harness" "-e" "undef *Test::Harness::Switches; test_harness(1, > 'blib/lib', 'blib/arch')" t/*.t > dying at -e line 1 > at /«PKGBUILDDIR»/blib/lib/B/PerlReq.pm line 388. > B::PerlReq::__ANON__("Can't locate object method \"sv\" via > package \"B::METHOP\" at /b"...) called at > /«PKGBUILDDIR»/blib/lib/B/Walker.pm line 25 > B::Walker::const_sv(B::METHOP=SCALAR(0xdec5e8)) called at > /«PKGBUILDDIR»/blib/lib/B/PerlReq.pm line 307 > B::PerlReq::grok_entersub(B::UNOP=SCALAR(0xdec5b8)) called at > /«PKGBUILDDIR»/blib/lib/B/Walker.pm line 56 > B::Walker::walk_root(B::UNOP=SCALAR(0xdec5b8)) called at > /«PKGBUILDDIR»/blib/lib/B/Walker.pm line 65 > B::Walker::walk_root(B::LISTOP=SCALAR(0xdec528)) called at > /«PKGBUILDDIR»/blib/lib/B/Walker.pm line 65 > B::Walker::walk_root(B::LISTOP=SCALAR(0xd00550)) called at > /«PKGBUILDDIR»/blib/lib/B/Walker.pm line 65 > B::Walker::walk_root(B::UNOP=SCALAR(0xd00778)) called at > /«PKGBUILDDIR»/blib/lib/B/Walker.pm line 91 > B::Walker::walk_cv(B::CV=SCALAR(0xe01830)) called at > /«PKGBUILDDIR»/blib/lib/B/Walker.pm line 77 > B::Walker::walk_av("BEGIN", B::AV=SCALAR(0xaf21f8)) called at > /«PKGBUILDDIR»/blib/lib/B/Walker.pm line 97 > B::Walker::walk_blocks() called at > /«PKGBUILDDIR»/blib/lib/B/PerlReq.pm line 390 > B::PerlReq::__ANON__() called at (eval 2) line 31 > O::CHECK() called at -e line 0 > eval {...} called at -e line 0 > Can't locate object method "sv" via package "B::METHOP" at > /«PKGBUILDDIR»/blib/lib/B/Walker.pm line 25. > CHECK failed--call queue aborted. >
Simple reproducer is: $ perl -Iblib/{arch,lib} -Mblib -MO=PerlReq -e 'use Data::Dumper' This is caused by this perl commit: commit b46e009d94293e069270690750f6c669c6d0ce22 Author: syber <syber@crazypanda.ru> Date: Thu Sep 4 22:08:59 2014 +0400 Make OP_METHOD* to be of new class METHOP Introduce a new opcode class, METHOP, which will hold class/method related info needed at runtime to improve performance of class/object method calls, then change OP_METHOD and OP_METHOD_NAMED from being UNOP/SVOP to being METHOP. Note that because OP_METHOD is a UNOP with an op_first, while OP_METHOD_NAMED is an SVOP, the first field of the METHOP structure is a union holding either op_first or op_sv. This was seen as less messy than having to introduce two new op classes. The new op class's character is '.' Nothing has changed in functionality and/or performance by this commit. It just introduces new structure which will be extended with extra fields and used in later commits. Added METHOP constructors: - newMETHOP() for method ops with dynamic method names. The only optype for this op is OP_METHOD. - newMETHOP_named() for method ops with constant method names. Optypes for this op are: OP_METHOD_NAMED (currently) and (later) OP_METHOD_SUPER, OP_METHOD_REDIR, OP_METHOD_NEXT, OP_METHOD_NEXTCAN, OP_METHOD_MAYBENEXT (This commit includes fixups by davem) And indeed the first encountered B::METHOP object with perl-5.22 was B::SVOP with perl-5.18.
From: ppisar [...] redhat.com
Download (untitled) / with headers
text/plain 807b
Dne Út 02.čen.2015 16:33:11, GREGOA napsal(a): Show quoted text
> This package FTBFS with perl 5.22: >
And there is another change for anoncode using srefgen now. See this perl commit: commit 01762542fcff2d3eb5e0fd287f28e872a0cfd5a4 Author: Father Chrysostomos <sprout@cpan.org> Date: Sat Oct 18 10:23:26 2014 -0700 Use srefgen for anoncode srefgen is faster than refgen, since it doesn’t have to loop through the arguments (there is only one) and there is no pushmark to execute. OA_RETSCALAR causes scalar context to be applied to anoncode ops, but it always returns one item anyway, so that causes no problems. and similar commits mentioning the srefgen. This causes failures on 'use Try::Tiny; try { require Foo } catch { require Bar }' code because it cannot find the try block.
From: ppisar [...] redhat.com
Download (untitled) / with headers
text/plain 148b
Dne Út 02.čen.2015 16:33:11, GREGOA napsal(a): Show quoted text
> This package FTBFS with perl 5.22: >
Attached patch makes changes needed for perl 5.22. -- Petr
Subject: rpm-build-perl-0.82-Adjust-to-perl-5.22.patch
From fc37d660dd918997669ef2c24cf4098104c6eb89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com> Date: Tue, 16 Jun 2015 18:20:20 +0200 Subject: [PATCH] Adjust to perl-5.22 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Perl 5.22 brought changes in class/method opcodes, see perl commit commit b46e009d94293e069270690750f6c669c6d0ce22 Author: syber <syber@crazypanda.ru> Date: Thu Sep 4 22:08:59 2014 +0400 Make OP_METHOD* to be of new class METHOP and optimizations in anoncode, see perl commit commit 01762542fcff2d3eb5e0fd287f28e872a0cfd5a4 Author: Father Chrysostomos <sprout@cpan.org> Date: Sat Oct 18 10:23:26 2014 -0700 Use srefgen for anoncode This patch implements the changes to make tests passing with perl 5.22. It does not aim for backward compatibility. CPAN RT#104885 Signed-off-by: Petr Písař <ppisar@redhat.com> --- lib/B/PerlReq.pm | 14 ++++++++++---- lib/B/Walker.pm | 9 ++++++++- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/lib/B/PerlReq.pm b/lib/B/PerlReq.pm index 303454f..b852f83 100644 --- a/lib/B/PerlReq.pm +++ b/lib/B/PerlReq.pm @@ -44,7 +44,7 @@ our @Skip = ( our ($Strict, $Relaxed, $Verbose, $Debug); -use B::Walker qw(const_sv); +use B::Walker qw(const_methop const_sv); sub RequiresPerl ($) { my $v = shift; @@ -273,8 +273,8 @@ my %TryCV; sub grok_try { return unless $INC{"Try/Tiny.pm"}; my (undef, $op) = @_; - return unless $op->name eq "refgen"; - $op = $op->first->first->sibling; + return unless $op->name eq "srefgen"; + $op = $op->first->first; return unless $op->name eq "anoncode"; my $cv = padval($op->targ); $TryCV{$$cv} = 1; @@ -304,7 +304,13 @@ sub grok_entersub ($) { $op = $op->sibling; } if ($op->name eq "method_named") { - my $method = const_sv($op)->PV; + my $method; + if (ref($op) eq 'B::METHOP') { + $method = const_methop($op); + } else { + $method = const_sv($op); + } + $method = $method->PV; return unless $methods{$method}; return unless $args->name eq "const"; my $sv = const_sv($args); diff --git a/lib/B/Walker.pm b/lib/B/Walker.pm index b71f204..9e3083c 100644 --- a/lib/B/Walker.pm +++ b/lib/B/Walker.pm @@ -6,7 +6,7 @@ use strict; require Exporter; our @ISA = qw(Exporter); -our @EXPORT_OK = qw(padname padval const_sv walk); +our @EXPORT_OK = qw(padname padval const_methop const_sv walk); our $CV; @@ -27,6 +27,13 @@ sub const_sv ($) { return $sv; } +sub const_methop ($) { + my $op = shift; + my $sv = $op->meth_sv; + $sv = padval($op->targ) unless $$sv; + return $sv; +} + our $Level = 0; our $Line; our $Sub; -- 2.1.0
From: ppisar [...] redhat.com
Download (untitled) / with headers
text/plain 284b
Dne Út 16.čen.2015 12:34:28, ppisar napsal(a): Show quoted text
> Dne Út 02.čen.2015 16:33:11, GREGOA napsal(a):
> > This package FTBFS with perl 5.22: > >
> Attached patch makes changes needed for perl 5.22. >
This patch replacing the previous one is also compatible with older perls. -- Petr
Subject: rpm-build-perl-0.82-Adjust-to-perl-5.22.patch
From 7d2911bc4694b272b1ed116bb7c87de644e8e1a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com> Date: Tue, 16 Jun 2015 18:20:20 +0200 Subject: [PATCH] Adjust to perl-5.22 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Perl 5.22 brought changes in class/method opcodes, see perl commit commit b46e009d94293e069270690750f6c669c6d0ce22 Author: syber <syber@crazypanda.ru> Date: Thu Sep 4 22:08:59 2014 +0400 Make OP_METHOD* to be of new class METHOP and optimizations in anoncode, see perl commit commit 01762542fcff2d3eb5e0fd287f28e872a0cfd5a4 Author: Father Chrysostomos <sprout@cpan.org> Date: Sat Oct 18 10:23:26 2014 -0700 Use srefgen for anoncode This patch implements the changes to make tests passing with perl 5.22 and previous versions too. CPAN RT#104885 Signed-off-by: Petr Písař <ppisar@redhat.com> --- lib/B/PerlReq.pm | 19 +++++++++++++++---- lib/B/Walker.pm | 9 ++++++++- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/lib/B/PerlReq.pm b/lib/B/PerlReq.pm index 303454f..4527b2b 100644 --- a/lib/B/PerlReq.pm +++ b/lib/B/PerlReq.pm @@ -44,7 +44,7 @@ our @Skip = ( our ($Strict, $Relaxed, $Verbose, $Debug); -use B::Walker qw(const_sv); +use B::Walker qw(const_methop const_sv); sub RequiresPerl ($) { my $v = shift; @@ -273,8 +273,13 @@ my %TryCV; sub grok_try { return unless $INC{"Try/Tiny.pm"}; my (undef, $op) = @_; - return unless $op->name eq "refgen"; - $op = $op->first->first->sibling; + if ($op->name eq "srefgen") { + $op = $op->first->first; + } elsif ($op->name eq "refgen") { + $op = $op->first->first->sibling; + } else { + return; + } return unless $op->name eq "anoncode"; my $cv = padval($op->targ); $TryCV{$$cv} = 1; @@ -304,7 +309,13 @@ sub grok_entersub ($) { $op = $op->sibling; } if ($op->name eq "method_named") { - my $method = const_sv($op)->PV; + my $method; + if (ref($op) eq 'B::METHOP') { + $method = const_methop($op); + } else { + $method = const_sv($op); + } + $method = $method->PV; return unless $methods{$method}; return unless $args->name eq "const"; my $sv = const_sv($args); diff --git a/lib/B/Walker.pm b/lib/B/Walker.pm index b71f204..9e3083c 100644 --- a/lib/B/Walker.pm +++ b/lib/B/Walker.pm @@ -6,7 +6,7 @@ use strict; require Exporter; our @ISA = qw(Exporter); -our @EXPORT_OK = qw(padname padval const_sv walk); +our @EXPORT_OK = qw(padname padval const_methop const_sv walk); our $CV; @@ -27,6 +27,13 @@ sub const_sv ($) { return $sv; } +sub const_methop ($) { + my $op = shift; + my $sv = $op->meth_sv; + $sv = padval($op->targ) unless $$sv; + return $sv; +} + our $Level = 0; our $Line; our $Sub; -- 2.1.0
From: ppisar [...] redhat.com
Download (untitled) / with headers
text/plain 1.1k
Dne Út 16.čen.2015 12:34:28, ppisar napsal(a): Show quoted text
> Dne Út 02.čen.2015 16:33:11, GREGOA napsal(a):
> > This package FTBFS with perl 5.22: > >
> Attached patch makes changes needed for perl 5.22. >
The patch is not enough: $ perl -MO=PerlReq -e 'sub foo{} foo' dying at -e line 1 at /usr/lib64/perl5/vendor_perl/B/PerlReq.pm line 399. B::PerlReq::__ANON__("Can't locate object method \"NAME\" via package \"B::IV\" at /usr"...) called at /usr/lib64/perl5/vendor_perl/B/PerlReq.pm line 330 B::PerlReq::grok_entersub(B::UNOP=SCALAR(0x154c6a0)) called at /usr/lib64/perl5/vendor_perl/B/Walker.pm line 63 B::Walker::walk_root(B::UNOP=SCALAR(0x154c6a0)) called at /usr/lib64/perl5/vendor_perl/B/Walker.pm line 72 B::Walker::walk_root(B::LISTOP=SCALAR(0x154c778)) called at /usr/lib64/perl5/vendor_perl/B/Walker.pm line 112 B::Walker::walk_main() called at /usr/lib64/perl5/vendor_perl/B/PerlReq.pm line 402 B::PerlReq::__ANON__() called at (eval 2) line 31 O::CHECK() called at -e line 0 eval {...} called at -e line 0 Can't locate object method "NAME" via package "B::IV" at /usr/lib64/perl5/vendor_perl/B/PerlReq.pm line 330. CHECK failed--call queue aborted.
From: ppisar [...] redhat.com
Download (untitled) / with headers
text/plain 617b
Dne St 17.čen.2015 02:49:48, ppisar napsal(a): Show quoted text
> Dne Út 16.čen.2015 12:34:28, ppisar napsal(a):
> > Dne Út 02.čen.2015 16:33:11, GREGOA napsal(a):
> > > This package FTBFS with perl 5.22: > > >
> > Attached patch makes changes needed for perl 5.22. > >
> The patch is not enough: > > $ perl -MO=PerlReq -e 'sub foo{} foo' > dying at -e line 1 > at /usr/lib64/perl5/vendor_perl/B/PerlReq.pm line 399. > B::PerlReq::__ANON__("Can't locate object method \"NAME\" via > package \"B::IV\" at /usr"...) called at > /usr/lib64/perl5/vendor_perl/B/PerlReq.pm line 330 >
Attached cumulative patch should fix it.
Subject: rpm-build-perl-0.82-Fix-non-deterministic-failures-on-newer-perls.patch
From 428c3feac1e9c39f966cc66c36cc3881d202177c Mon Sep 17 00:00:00 2001 From: Niko Tyni <ntyni@debian.org> Date: Sat, 18 May 2013 09:41:47 +0300 Subject: [PATCH] Fix non-deterministic failures on newer perls The hash randomization changes in the Perl 5.17 series made perl.req to occasionally fail to report the dependencies. Improved diagnostics report Use of each() on hash after insertion without resetting hash iterator results in undefined behavior, Perl interpreter: 0x9e7010 at /home/niko/tmp/libb-perlreq-perl-0.82/blib/lib/B/Walker.pm line 122. so use keys() instead of each(), as suggested by perldiag.pod. --- lib/B/Walker.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/B/Walker.pm b/lib/B/Walker.pm index b71f204..f626043 100644 --- a/lib/B/Walker.pm +++ b/lib/B/Walker.pm @@ -119,7 +119,7 @@ sub walk_gv ($) { sub walk_stash ($$); sub walk_stash ($$) { # similar to B::walksymtable my ($symref, $prefix) = @_; - while (my ($sym) = each %$symref) { + for my $sym (keys %$symref) { no strict 'refs'; my $fullname = "*main::". $prefix . $sym; if ($sym =~ /::\z/) { -- 1.7.10.4
Subject: Re: [rt.cpan.org #104885] FTBFS with perl 5.22
Date: Wed, 17 Jun 2015 17:39:49 +0200
To: Petr Pisar via RT <bug-rpm-build-perl [...] rt.cpan.org>
From: gregor herrmann <gregoa [...] debian.org>
Download (untitled) / with headers
text/plain 698b
On Wed, 17 Jun 2015 04:13:45 -0400, Petr Pisar via RT wrote: Show quoted text
Show quoted text
> > > > This package FTBFS with perl 5.22:
> > > Attached patch makes changes needed for perl 5.22.
> > The patch is not enough:
> Attached cumulative patch should fix it.
Hm, this is ntyni's "old" patch for perl 5.17+ from 2013. Did you mean to attach a different patch? Cheers, gregor -- .''`. Homepage: http://info.comodo.priv.at/ - OpenPGP key 0xBB3A68018649AA06 : :' : Debian GNU/Linux user, admin, and developer - https://www.debian.org/ `. `' Member of VIBE!AT & SPI, fellow of the Free Software Foundation Europe `- NP: Funny Van Dannen: Tütensuppen
Download signature.asc
application/pgp-signature 949b

Message body not shown because it is not plain text.

From: ppisar [...] redhat.com
Download (untitled) / with headers
text/plain 472b
Dne St 17.čen.2015 11:40:17, gregoa@debian.org napsal(a): Show quoted text
> On Wed, 17 Jun 2015 04:13:45 -0400, Petr Pisar via RT wrote:
> > > > > This package FTBFS with perl 5.22:
> > > > Attached patch makes changes needed for perl 5.22.
> > > The patch is not enough:
> > Attached cumulative patch should fix it.
> > Hm, this is ntyni's "old" patch for perl 5.17+ from 2013. > Did you mean to attach a different patch? >
You are right. I hope this attachment is the desired one.
Subject: rpm-build-perl-0.82-Adjust-to-perl-5.22.patch
From b73a37a7eb615693b5516068360f61d5b4e8f241 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com> Date: Tue, 16 Jun 2015 18:20:20 +0200 Subject: [PATCH] Adjust to perl-5.22 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Perl 5.22 brought changes in class/method opcodes, see perl commit commit b46e009d94293e069270690750f6c669c6d0ce22 Author: syber <syber@crazypanda.ru> Date: Thu Sep 4 22:08:59 2014 +0400 Make OP_METHOD* to be of new class METHOP and optimizations in anoncode, see perl commit commit 01762542fcff2d3eb5e0fd287f28e872a0cfd5a4 Author: Father Chrysostomos <sprout@cpan.org> Date: Sat Oct 18 10:23:26 2014 -0700 Use srefgen for anoncode and GV to IV optimizations when calling some subroutines. This patch implements the changes to make tests passing with perl 5.22 and previous versions too. CPAN RT#104885 Signed-off-by: Petr Písař <ppisar@redhat.com> --- lib/B/PerlReq.pm | 24 +++++++++++++++++++----- lib/B/Walker.pm | 9 ++++++++- t/01-B-PerlReq.t | 3 +++ 3 files changed, 30 insertions(+), 6 deletions(-) diff --git a/lib/B/PerlReq.pm b/lib/B/PerlReq.pm index 303454f..2e2a2ba 100644 --- a/lib/B/PerlReq.pm +++ b/lib/B/PerlReq.pm @@ -44,7 +44,7 @@ our @Skip = ( our ($Strict, $Relaxed, $Verbose, $Debug); -use B::Walker qw(const_sv); +use B::Walker qw(const_methop const_sv); sub RequiresPerl ($) { my $v = shift; @@ -273,8 +273,13 @@ my %TryCV; sub grok_try { return unless $INC{"Try/Tiny.pm"}; my (undef, $op) = @_; - return unless $op->name eq "refgen"; - $op = $op->first->first->sibling; + if ($op->name eq "srefgen") { + $op = $op->first->first; + } elsif ($op->name eq "refgen") { + $op = $op->first->first->sibling; + } else { + return; + } return unless $op->name eq "anoncode"; my $cv = padval($op->targ); $TryCV{$$cv} = 1; @@ -304,7 +309,13 @@ sub grok_entersub ($) { $op = $op->sibling; } if ($op->name eq "method_named") { - my $method = const_sv($op)->PV; + my $method; + if (ref($op) eq 'B::METHOP') { + $method = const_methop($op); + } else { + $method = const_sv($op); + } + $method = $method->PV; return unless $methods{$method}; return unless $args->name eq "const"; my $sv = const_sv($args); @@ -316,7 +327,10 @@ sub grok_entersub ($) { elsif ($op->first->name eq "gv") { $op = $op->first; use B::Walker qw(padval); - my $func = padval($op->padix)->NAME; + my $padval = padval($op->padix); + # perl 5.22 sometimes optimizes to B::IV + return unless ref $padval eq 'B::GV'; + my $func = $padval->NAME; return unless $funcs{$func}; $funcs{$func}->($func, $args); } diff --git a/lib/B/Walker.pm b/lib/B/Walker.pm index b71f204..9e3083c 100644 --- a/lib/B/Walker.pm +++ b/lib/B/Walker.pm @@ -6,7 +6,7 @@ use strict; require Exporter; our @ISA = qw(Exporter); -our @EXPORT_OK = qw(padname padval const_sv walk); +our @EXPORT_OK = qw(padname padval const_methop const_sv walk); our $CV; @@ -27,6 +27,13 @@ sub const_sv ($) { return $sv; } +sub const_methop ($) { + my $op = shift; + my $sv = $op->meth_sv; + $sv = padval($op->targ) unless $$sv; + return $sv; +} + our $Level = 0; our $Line; our $Sub; diff --git a/t/01-B-PerlReq.t b/t/01-B-PerlReq.t index 7233cb6..6e02759 100644 --- a/t/01-B-PerlReq.t +++ b/t/01-B-PerlReq.t @@ -139,4 +139,7 @@ EOF cmp_ok "perl(Cwd.pm) >= 1.0", "eq", grok q(use Cwd 0==0); +# perl 5.22 sometimes optimizes to B::IV leading to crash +cmp_ok "$d", "eq", grok qq(sub foo{} foo; require $m;); + #END { $? = 0; } -- 2.1.0
Thanks, this seems to work. Cheers, gregor


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.