[perl-Convert-PEM] Disable tests relying on probabilistic output

Petr Pisar ppisar at fedoraproject.org
Fri Sep 5 10:25:52 UTC 2014


commit b8e0434727aa9a30d502c7b8d10d46b877f7def5
Author: Petr Písař <ppisar at redhat.com>
Date:   Fri Sep 5 11:17:18 2014 +0200

    Disable tests relying on probabilistic output

 ...-the-reason-for-decryption-failure-on-bad.patch |   69 ++++++++++++++++++++
 perl-Convert-PEM.spec                              |    8 ++-
 2 files changed, 76 insertions(+), 1 deletions(-)
---
diff --git a/Convert-PEM-0.08-Do-not-test-the-reason-for-decryption-failure-on-bad.patch b/Convert-PEM-0.08-Do-not-test-the-reason-for-decryption-failure-on-bad.patch
new file mode 100644
index 0000000..c062a7b
--- /dev/null
+++ b/Convert-PEM-0.08-Do-not-test-the-reason-for-decryption-failure-on-bad.patch
@@ -0,0 +1,69 @@
+From 2d6ec9bc13a0994ba5a5911c1c210082ed4da09f Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar at redhat.com>
+Date: Fri, 5 Sep 2014 11:04:30 +0200
+Subject: [PATCH] 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.
+
+CPAN RT#27574
+
+Signed-off-by: Petr Písař <ppisar at redhat.com>
+---
+ 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';
+ 
+-- 
+1.9.3
+
diff --git a/perl-Convert-PEM.spec b/perl-Convert-PEM.spec
index c8d1e2c..1d35ffc 100644
--- a/perl-Convert-PEM.spec
+++ b/perl-Convert-PEM.spec
@@ -1,11 +1,13 @@
 Name:           perl-Convert-PEM
 Version:        0.08
-Release:        13%{?dist}
+Release:        14%{?dist}
 Summary:        Read/write encrypted ASN.1 PEM files
 License:        GPL+ or Artistic
 Group:          Development/Libraries
 URL:            http://search.cpan.org/dist/Convert-PEM/
 Source0:        http://www.cpan.org/authors/id/B/BT/BTROTT/Convert-PEM-%{version}.tar.gz
+# Disable tests relying on probabilistic output, bug #1136745, CPAN RT#27574
+Patch0:         Convert-PEM-0.08-Do-not-test-the-reason-for-decryption-failure-on-bad.patch
 BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 BuildArch:      noarch
 BuildRequires:  perl(Class::ErrorHandler)
@@ -26,6 +28,7 @@ to ASN.1-encoded PEM files (with optional encryption).
 
 %prep
 %setup -q -n Convert-PEM-%{version}
+%patch0 -p1
 
 %build
 %{__perl} Makefile.PL INSTALLDIRS=vendor
@@ -54,6 +57,9 @@ rm -rf $RPM_BUILD_ROOT
 %{_mandir}/man3/*
 
 %changelog
+* Fri Sep 05 2014 Petr Pisar <ppisar at redhat.com> - 0.08-14
+- Disable tests relying on probabilistic output (bug #1136745)
+
 * Thu Aug 28 2014 Jitka Plesnikova <jplesnik at redhat.com> - 0.08-13
 - Perl 5.20 rebuild
 



More information about the perl-devel mailing list