[libb-perlreq-perl] 01/05: Add patch to fix compatibility with Perl 5.22.

gregor herrmann gregoa at debian.org
Thu Aug 20 20:48:34 UTC 2015


This is an automated email from the git hooks/post-receive script.

gregoa pushed a commit to branch master
in repository libb-perlreq-perl.

commit 9fee9ee6711dd1c14d6ecebf413eb85587736339
Author: gregor herrmann <gregoa at debian.org>
Date:   Thu Aug 20 22:36:54 2015 +0200

    Add patch to fix compatibility with Perl 5.22.
    
    Provided by ppisar at redhat.com at CPAN RT.
    
    Closes: #787461
---
 debian/patches/Adjust-to-perl-5.22.patch | 131 +++++++++++++++++++++++++++++++
 debian/patches/series                    |   1 +
 2 files changed, 132 insertions(+)

diff --git a/debian/patches/Adjust-to-perl-5.22.patch b/debian/patches/Adjust-to-perl-5.22.patch
new file mode 100644
index 0000000..b922e57
--- /dev/null
+++ b/debian/patches/Adjust-to-perl-5.22.patch
@@ -0,0 +1,131 @@
+Bug-Debian: https://bugs.debian.org/787461
+Bug: https://rt.cpan.org/Public/Bug/Display.html?id=104885
+Origin: https://rt.cpan.org/Public/Bug/Display.html?id=104885
+
+From b73a37a7eb615693b5516068360f61d5b4e8f241 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar at 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 at 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 at 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 at 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(-)
+
+--- a/lib/B/PerlReq.pm
++++ b/lib/B/PerlReq.pm
+@@ -44,7 +44,7 @@
+ 
+ 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 @@
+ 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 @@
+ 		$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 @@
+ 	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);
+ 	}
+--- a/lib/B/Walker.pm
++++ b/lib/B/Walker.pm
+@@ -6,7 +6,7 @@
+ 
+ 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;
+ 
+@@ -26,6 +26,13 @@
+ 	$sv = padval($op->targ) unless $$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;
+--- a/t/01-B-PerlReq.t
++++ b/t/01-B-PerlReq.t
+@@ -139,4 +139,7 @@
+ 
+ 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; }
diff --git a/debian/patches/series b/debian/patches/series
index 99617d5..75ef1be 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,2 +1,3 @@
 spelling.patch
 0001-Fix-non-deterministic-failures-on-newer-perls.patch
+Adjust-to-perl-5.22.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libb-perlreq-perl.git



More information about the Pkg-perl-cvs-commits mailing list