commit:     ad0a949482b82e580f22114f7b0c4396b4b29500
Author:     Kent Fredric <kentnl <AT> gentoo <DOT> org>
AuthorDate: Mon Oct  2 16:09:03 2017 +0000
Commit:     Kent Fredric <kentnl <AT> gentoo <DOT> org>
CommitDate: Mon Oct  2 16:12:25 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ad0a9494

dev-perl/Convert-PEM: Fix random test failures bug #625652

Also:
- Migrate Module::Install sed to a patch
- Fix Test::Builder warnings

Closes: https://bugs.gentoo.org/625652
Package-Manager: Portage-2.3.8, Repoman-2.3.3

 dev-perl/Convert-PEM/Convert-PEM-0.80.0-r1.ebuild  | 11 ++--
 .../Convert-PEM/files/Convert-PEM-0.80.0-526.patch | 23 +++++++
 .../files/Convert-PEM-0.80.0-decryptiontest.patch  | 70 ++++++++++++++++++++++
 .../files/Convert-PEM-0.80.0-testbuilder.patch     | 29 +++++++++
 4 files changed, 127 insertions(+), 6 deletions(-)

diff --git a/dev-perl/Convert-PEM/Convert-PEM-0.80.0-r1.ebuild 
b/dev-perl/Convert-PEM/Convert-PEM-0.80.0-r1.ebuild
index b62dc7538e2..469ab38663d 100644
--- a/dev-perl/Convert-PEM/Convert-PEM-0.80.0-r1.ebuild
+++ b/dev-perl/Convert-PEM/Convert-PEM-0.80.0-r1.ebuild
@@ -21,11 +21,10 @@ RDEPEND="
        virtual/perl-MIME-Base64
 "
 DEPEND="${RDEPEND}"
+PATCHES=(
+       "${FILESDIR}/${P}-526.patch"
+       "${FILESDIR}/${P}-decryptiontest.patch"
+       "${FILESDIR}/${P}-testbuilder.patch"
+)
 
 SRC_TEST=do
-
-src_prepare() {
-       sed -i -e 's/use inc::Module::Install;/use lib q[.]; use 
inc::Module::Install;/' Makefile.PL ||
-               die "Can't patch Makefile.PL for 5.26 dot-in-inc"
-       perl-module_src_prepare
-}

diff --git a/dev-perl/Convert-PEM/files/Convert-PEM-0.80.0-526.patch 
b/dev-perl/Convert-PEM/files/Convert-PEM-0.80.0-526.patch
new file mode 100644
index 00000000000..49c74e5e688
--- /dev/null
+++ b/dev-perl/Convert-PEM/files/Convert-PEM-0.80.0-526.patch
@@ -0,0 +1,23 @@
+From 22b4a18d00c7080972341db2052041448391fbfe Mon Sep 17 00:00:00 2001
+From: Kent Fredric <[email protected]>
+Date: Sun, 11 Jun 2017 14:42:41 +1200
+Subject: Fix Makefile.PL for Perl 5.26 w/o "." in @INC
+
+Bug: https://bugs.gentoo.org/613632
+Bug: https://rt.cpan.org/Ticket/Display.html?id=120714
+---
+ Makefile.PL | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/Makefile.PL b/Makefile.PL
+index 8d4d686..3e87348 100644
+--- a/Makefile.PL
++++ b/Makefile.PL
+@@ -1,3 +1,4 @@
++use lib '.';
+ use inc::Module::Install;
+ name 'Convert-PEM';
+ all_from 'lib/Convert/PEM.pm';
+-- 
+2.14.1
+

diff --git a/dev-perl/Convert-PEM/files/Convert-PEM-0.80.0-decryptiontest.patch 
b/dev-perl/Convert-PEM/files/Convert-PEM-0.80.0-decryptiontest.patch
new file mode 100644
index 00000000000..3fac17d111d
--- /dev/null
+++ b/dev-perl/Convert-PEM/files/Convert-PEM-0.80.0-decryptiontest.patch
@@ -0,0 +1,70 @@
+From 9b8f76ece49348cfdc50c5e3b4098694e07184d6 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <[email protected]>
+Date: Fri, 5 Sep 2014 11:04:30 +0200
+Subject: Do not test the reason for decryption failure on bad key
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Tests checking error message after using bad decryption key fails
+randomly.
+
+Some bad keys can fool the "Bad key/passphrase" heuristic in the
+Convert::PEM::CBC::decode() because it's a feature a stream cipher to
+spit out bad output on bad key. So the heuristic is just a kind
+service to point to the cause of the decoding failure (i.e. bad key).
+By probabilistic nature of the heuristic, we cannot rely on the
+/^Decryption failed/ error message.
+
+This patch removes these tests.
+
+Bug: https://rt.cpan.org/Ticket/Display.html?id=27574
+Bug: https://bugs.gentoo.org/625652
+
+Signed-off-by: Petr Písař <[email protected]>
+---
+ t/01-readwrite.t | 3 +--
+ t/02-encode.t    | 3 +--
+ 2 files changed, 2 insertions(+), 4 deletions(-)
+
+diff --git a/t/01-readwrite.t b/t/01-readwrite.t
+index 42a4416..208eba1 100644
+--- a/t/01-readwrite.t
++++ b/t/01-readwrite.t
+@@ -1,5 +1,5 @@
+ use strict;
+-use Test::More tests => 16;
++use Test::More tests => 15;
+ use Test::Exception;
+ 
+ use Convert::PEM;
+@@ -29,7 +29,6 @@ lives_ok { $pem->write( Filename => $objfile, Content => 
$obj, Password => 'xx'
+ ok -e $objfile, 'output file exists';
+ lives_ok { $obj2 = $pem->read( Filename => $objfile ) } 'can read';
+ ok !defined $obj2, 'cannot read encrypted file';
+-like $pem->errstr, qr/^Decryption failed/, 'errstr matches decryption failed';
+ lives_ok { $obj2 = $pem->read( Filename => $objfile, Password => 'xx') } 'can 
read';
+ is $obj->{TestObject}{int}, $obj2->{TestObject}{int}, 'input matches output';
+ unlink $objfile;
+diff --git a/t/02-encode.t b/t/02-encode.t
+index 37aa987..9c6ab4c 100644
+--- a/t/02-encode.t
++++ b/t/02-encode.t
+@@ -1,5 +1,5 @@
+ use strict;
+-use Test::More tests => 9;
++use Test::More tests => 8;
+ 
+ use Convert::PEM;
+ use Math::BigInt;
+@@ -25,7 +25,6 @@ $blob = $pem->encode( Content => $obj, Password => 'xx' );
+ ok $blob, 'encode gave us something';
+ $obj2 = $pem->decode( Content => $blob );
+ ok !defined $obj2, 'decode fails on encrypted input';
+-like $pem->errstr, qr/^Decryption failed/, 'errstr matches decrypt failed';
+ $obj2 = $pem->decode( Content => $blob, Password => 'xx' );
+ is $obj->{TestObject}{int}, $obj2->{TestObject}{int}, 'input matches output';
+ 
+-- 
+2.14.1
+

diff --git a/dev-perl/Convert-PEM/files/Convert-PEM-0.80.0-testbuilder.patch 
b/dev-perl/Convert-PEM/files/Convert-PEM-0.80.0-testbuilder.patch
new file mode 100644
index 00000000000..f12b64d5c5f
--- /dev/null
+++ b/dev-perl/Convert-PEM/files/Convert-PEM-0.80.0-testbuilder.patch
@@ -0,0 +1,29 @@
+From 831b57ff2167e1192964c190271767e469dac48a Mon Sep 17 00:00:00 2001
+From: Kent Fredric <[email protected]>
+Date: Tue, 3 Oct 2017 05:01:21 +1300
+Subject: Fix Test::Builder warning
+
+Ideally upstream should just stop bundling Test::Builder, but this
+is the smallest change that avoids the issue
+
+Bug: https://rt.cpan.org/Ticket/Display.html?id=111009
+---
+ inc/Test/Builder.pm | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/inc/Test/Builder.pm b/inc/Test/Builder.pm
+index 795361f..6b0c8c3 100644
+--- a/inc/Test/Builder.pm
++++ b/inc/Test/Builder.pm
+@@ -589,7 +589,7 @@ sub _is_dualvar {
+ 
+     no warnings 'numeric';
+     my $numval = $val + 0;
+-    return $numval != 0 and $numval ne $val ? 1 : 0;
++    return ($numval != 0 and $numval ne $val ? 1 : 0);
+ }
+ 
+ #line 876
+-- 
+2.14.1
+

Reply via email to