From 61217e9d9d3e833fa66b36c9efbd531e6c56b252 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <[email protected]>
Date: Tue, 7 Feb 2017 15:01:08 +0100
Subject: Adapt tests to zlib-1.2.11

---
 ...Raw-Zlib-2.071-Adapt-tests-to-zlib-1.2.11.patch | 94 ++++++++++++++++++++++
 perl-Compress-Raw-Zlib.spec                        |  8 +-
 2 files changed, 101 insertions(+), 1 deletion(-)
 create mode 100644 Compress-Raw-Zlib-2.071-Adapt-tests-to-zlib-1.2.11.patch

diff --git a/Compress-Raw-Zlib-2.071-Adapt-tests-to-zlib-1.2.11.patch 
b/Compress-Raw-Zlib-2.071-Adapt-tests-to-zlib-1.2.11.patch
new file mode 100644
index 0000000..5711c2a
--- /dev/null
+++ b/Compress-Raw-Zlib-2.071-Adapt-tests-to-zlib-1.2.11.patch
@@ -0,0 +1,94 @@
+From b42f5c088158f473116d3aca2d050d4efb95b021 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <[email protected]>
+Date: Tue, 7 Feb 2017 14:44:48 +0100
+Subject: [PATCH] Adapt tests to zlib 1.2.11
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Since zlib-1.2.9 it's not safe to invoke deflateParams() when not all
+input was consumed by deflate(). deflateParams() could return
+Z_BUF_ERROR in some cases:
+
+commit 7161ad76e2d0ac7de2a6235fcad3b9dfc99e9140
+Author: Mark Adler <[email protected]>
+Date:   Tue Nov 22 23:29:19 2016 -0800
+
+    Assure that deflateParams() will not switch functions mid-block.
+
+    This alters the specification in zlib.h, so that deflateParams()
+    will not change any parameters if there is not enough output space
+    in the event that a block is emitted in order to allow switching
+    the compression function.
+
+zlib documentation recommends two fixes:
+
+To retry deflateParams() as it processes a piece of input underneath
+until something else than Z_BUF_ERROR is returned. However this does
+not work for me because then the compressed stream gets corrupted
+and the subsequent inflate() returns a failure.
+
+Another fix is to flush the deflated stream with Z_BLOCK just before
+any deflateParams() call that follows unifinished deflate(). This
+assures the new deflate options will be applied immediatelly on next
+deflate() call. This fix works for me. Thus I implemented it in the
+tests.
+
+The new tests pass with zlib 1.2.8 as well as 1.2.11. 1.2.9 and 1.2.10
+seems broken changing the deflate options was fixed in 1.2.11.
+
+CPAN RT#119762
+
+Signed-off-by: Petr Písař <[email protected]>
+---
+ t/02zlib.t | 9 ++++++---
+ 1 file changed, 6 insertions(+), 3 deletions(-)
+
+diff --git a/t/02zlib.t b/t/02zlib.t
+index 2c9aad6..50f6a82 100644
+--- a/t/02zlib.t
++++ b/t/02zlib.t
+@@ -24,13 +24,13 @@ BEGIN
+ 
+     my $count = 0 ;
+     if ($] < 5.005) {
+-        $count = 232 ;
++        $count = 236 ;
+     }
+     elsif ($] >= 5.006) {
+-        $count = 317 ;
++        $count = 320 ;
+     }
+     else {
+-        $count = 275 ;
++        $count = 278 ;
+     }
+ 
+     plan tests => $count + $extra;
+@@ -537,6 +537,7 @@ SKIP:
+      
+     $status = $x->deflate($hello, $Answer) ;
+     cmp_ok $status, '==', Z_OK ;
++    cmp_ok $x->flush($Answer, Z_BLOCK), '==', Z_OK ;
+     $input .= $hello;
+     
+     # error cases
+@@ -561,6 +562,7 @@ SKIP:
+      
+     $status = $x->deflate($goodbye, $Answer) ;
+     cmp_ok $status, '==', Z_OK ;
++    cmp_ok $x->flush($Answer, Z_BLOCK), '==', Z_OK ;
+     $input .= $goodbye;
+     
+     # change only Level 
+@@ -572,6 +574,7 @@ SKIP:
+      
+     $status = $x->deflate($goodbye, $Answer) ;
+     cmp_ok $status, '==', Z_OK ;
++    cmp_ok $x->flush($Answer, Z_BLOCK), '==', Z_OK ;
+     $input .= $goodbye;
+     
+     # change only Strategy
+-- 
+2.7.4
+
diff --git a/perl-Compress-Raw-Zlib.spec b/perl-Compress-Raw-Zlib.spec
index c51fbe1..43c4e90 100644
--- a/perl-Compress-Raw-Zlib.spec
+++ b/perl-Compress-Raw-Zlib.spec
@@ -1,6 +1,6 @@
 Name:           perl-Compress-Raw-Zlib
 Version:        2.071
-Release:        1%{?dist}
+Release:        2%{?dist}
 Summary:        Low-level interface to the zlib compression library
 # Zlib.xs: (GPL+ or Artistic) and zlib
 # Others:  GPL+ or Artistic
@@ -8,6 +8,8 @@ License:        (GPL+ or Artistic) and zlib
 Group:          Development/Libraries
 URL:            http://search.cpan.org/dist/Compress-Raw-Zlib/
 Source0:        
http://search.cpan.org/CPAN/authors/id/P/PM/PMQS/Compress-Raw-Zlib-%{version}.tar.gz
+# Adapt tests to zlib-1.2.11, bug #1419841, CPAN RT#119762
+Patch0:         Compress-Raw-Zlib-2.071-Adapt-tests-to-zlib-1.2.11.patch
 # Module Build
 BuildRequires:  coreutils
 BuildRequires:  findutils
@@ -56,6 +58,7 @@ compression library, which is used by IO::Compress::Zlib.
 
 %prep
 %setup -q -n Compress-Raw-Zlib-%{version}
+%patch0 -p1
 
 %build
 OLD_ZLIB=False
@@ -82,6 +85,9 @@ make test COMPRESS_ZLIB_RUN_MOST=1
 %{_mandir}/man3/Compress::Raw::Zlib.3*
 
 %changelog
+* Tue Feb 07 2017 Petr Pisar <[email protected]> - 2.071-2
+- Adapt tests to zlib-1.2.11 (bug #1419841)
+
 * Sat Dec 31 2016 Paul Howarth <[email protected]> - 2.071-1
 - Update to 2.071
   - One (last?) compilation warning in bundled inflate.c (CPAN RT#119580,
-- 
cgit v1.1


        
https://src.fedoraproject.org/cgit/perl-Compress-Raw-Zlib.git/commit/?h=master&id=61217e9d9d3e833fa66b36c9efbd531e6c56b252
_______________________________________________
perl-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to