From 9caa36433dd2698d53bbf69801115880ab626428961b30bcbaceff45c22ec3f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Schr=C3=B6der?= Date: Fri, 19 May 2017 13:54:21 +0000 Subject: [PATCH] Accepting request 496340 from home:scarabeus_iv:branches:devel:languages:perl - Remove patch from previous commit, does not work: * Compress-Raw-Zlib-2.071-Adapt-tests-to-zlib-1.2.11.patch - Add patch taken from upstream release instead: * Compress-Raw-Zlib-2.071-zlib-1.2.11.patch OBS-URL: https://build.opensuse.org/request/show/496340 OBS-URL: https://build.opensuse.org/package/show/devel:languages:perl/perl?expand=0&rev=149 --- ...lib-2.071-Adapt-tests-to-zlib-1.2.11.patch | 45 --- Compress-Raw-Zlib-2.071-zlib-1.2.11.patch | 372 ++++++++++++++++++ perl.changes | 8 + perl.spec | 4 +- 4 files changed, 382 insertions(+), 47 deletions(-) delete mode 100644 Compress-Raw-Zlib-2.071-Adapt-tests-to-zlib-1.2.11.patch create mode 100644 Compress-Raw-Zlib-2.071-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 deleted file mode 100644 index 95d56e4..0000000 --- a/Compress-Raw-Zlib-2.071-Adapt-tests-to-zlib-1.2.11.patch +++ /dev/null @@ -1,45 +0,0 @@ -Index: cpan/Compress-Raw-Zlib/t/02zlib.t -=================================================================== ---- cpan/Compress-Raw-Zlib/t/02zlib.t.orig -+++ cpan/Compress-Raw-Zlib/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 diff --git a/Compress-Raw-Zlib-2.071-zlib-1.2.11.patch b/Compress-Raw-Zlib-2.071-zlib-1.2.11.patch new file mode 100644 index 0000000..d928ec7 --- /dev/null +++ b/Compress-Raw-Zlib-2.071-zlib-1.2.11.patch @@ -0,0 +1,372 @@ +Index: perl-5.24.1/cpan/Compress-Raw-Zlib/Zlib.xs +=================================================================== +--- perl-5.24.1.orig/cpan/Compress-Raw-Zlib/Zlib.xs ++++ perl-5.24.1/cpan/Compress-Raw-Zlib/Zlib.xs +@@ -74,6 +74,10 @@ + # define AT_LEAST_ZLIB_1_2_8 + #endif + ++#if defined(ZLIB_VERNUM) && ZLIB_VERNUM >= 0x1290 ++# define AT_LEAST_ZLIB_1_2_9 ++#endif ++ + #ifdef USE_PPPORT_H + # define NEED_sv_2pvbyte + # define NEED_sv_2pv_nolen +@@ -134,12 +138,13 @@ typedef struct di_stream { + uLong dict_adler ; + int last_error ; + bool zip_mode ; +-#define SETP_BYTE ++/* #define SETP_BYTE */ + #ifdef SETP_BYTE ++ /* SETP_BYTE only works with zlib up to 1.2.8 */ + bool deflateParams_out_valid ; + Bytef deflateParams_out_byte; + #else +-#define deflateParams_BUFFER_SIZE 0x4000 ++#define deflateParams_BUFFER_SIZE 0x40000 + uLong deflateParams_out_length; + Bytef* deflateParams_out_buffer; + #endif +@@ -636,6 +641,103 @@ char * string ; + return sv ; + } + ++#if 0 ++int ++flushToBuffer(di_stream* s, int flush) ++{ ++ dTHX; ++ int ret ; ++ z_stream * strm = &s->stream; ++ ++ Bytef* output = s->deflateParams_out_buffer ; ++ ++ strm->next_in = NULL; ++ strm->avail_in = 0; ++ ++ uLong total_output = 0; ++ uLong have = 0; ++ ++ do ++ { ++ if (output) ++ output = (unsigned char *)saferealloc(output, total_output + s->bufsize); ++ else ++ output = (unsigned char *)safemalloc(s->bufsize); ++ ++ strm->next_out = output + total_output; ++ strm->avail_out = s->bufsize; ++ ++ ret = deflate(strm, flush); /* no bad return value */ ++ //assert(ret != Z_STREAM_ERROR); /* state not clobbered */ ++ if(ret == Z_STREAM_ERROR) ++ { ++ safefree(output); ++ return ret; ++ } ++ have = s->bufsize - strm->avail_out; ++ total_output += have; ++ ++ //fprintf(stderr, "FLUSH %s %d, return %d\n", flush_flags[flush], have, ret); ++ ++ } while (strm->avail_out == 0); ++ ++ s->deflateParams_out_buffer = output; ++ s->deflateParams_out_length = total_output; ++ ++ return Z_OK; ++} ++#endif ++ ++#ifndef SETP_BYTE ++int ++flushParams(di_stream* s) ++{ ++ dTHX; ++ int ret ; ++ z_stream * strm = &s->stream; ++ ++ Bytef* output = s->deflateParams_out_buffer ; ++ uLong total_output = s->deflateParams_out_length; ++ ++ uLong have = 0; ++ ++ strm->next_in = NULL; ++ strm->avail_in = 0; ++ ++ do ++ { ++ if (output) ++ output = (unsigned char *)saferealloc(output, total_output + s->bufsize); ++ else ++ output = (unsigned char *)safemalloc(s->bufsize); ++ ++ strm->next_out = output + total_output; ++ strm->avail_out = s->bufsize; ++ ++ ret = deflateParams(&(s->stream), s->Level, s->Strategy); ++ /* fprintf(stderr, "deflateParams %d %s %lu\n", ret, ++ GetErrorString(ret), s->bufsize - strm->avail_out); */ ++ ++ if (ret == Z_STREAM_ERROR) ++ break; ++ ++ have = s->bufsize - strm->avail_out; ++ total_output += have; ++ ++ ++ } while (ret == Z_BUF_ERROR) ; ++ ++ if(ret == Z_STREAM_ERROR) ++ safefree(output); ++ else ++ { ++ s->deflateParams_out_buffer = output; ++ s->deflateParams_out_length = total_output; ++ } ++ ++ return ret; ++} ++#endif /* ! SETP_BYTE */ + + #include "constants.h" + +@@ -991,20 +1093,24 @@ deflate (s, buf, output) + /* Check for saved output from deflateParams */ + if (s->deflateParams_out_length) { + uLong plen = s->deflateParams_out_length ; +- /* printf("Copy %d bytes saved data\n", plen);*/ ++ /* printf("Copy %lu bytes saved data\n", plen); */ + if (s->stream.avail_out < plen) { +- /*printf("GROW from %d to %d\n", s->stream.avail_out, +- SvLEN(output) + plen - s->stream.avail_out); */ +- Sv_Grow(output, SvLEN(output) + plen - s->stream.avail_out) ; ++ /* printf("GROW from %d to %lu\n", s->stream.avail_out, ++ SvLEN(output) + plen - s->stream.avail_out); */ ++ s->stream.next_out = (Bytef*) Sv_Grow(output, SvLEN(output) + plen - s->stream.avail_out) ; ++ s->stream.next_out += cur_length; + } + +- Copy(s->stream.next_out, s->deflateParams_out_buffer, plen, Bytef) ; +- cur_length = cur_length + plen; ++ Copy(s->deflateParams_out_buffer, s->stream.next_out, plen, Bytef) ; ++ cur_length += plen; + SvCUR_set(output, cur_length); +- s->stream.next_out += plen ; +- s->stream.avail_out = SvLEN(output) - cur_length ; +- increment = s->stream.avail_out; +- s->deflateParams_out_length = 0; ++ s->stream.next_out += plen ; ++ s->stream.avail_out = SvLEN(output) - cur_length ; ++ increment = s->stream.avail_out; ++ ++ s->deflateParams_out_length = 0; ++ Safefree(s->deflateParams_out_buffer); ++ s->deflateParams_out_buffer = NULL; + } + #endif + RETVAL = Z_OK ; +@@ -1027,6 +1133,12 @@ deflate (s, buf, output) + } + + RETVAL = deflate(&(s->stream), Z_NO_FLUSH); ++ if (RETVAL != Z_STREAM_ERROR) { ++ int done = increment - s->stream.avail_out ; ++ /* printf("std DEFLATEr returned %d '%s' avail in %d, out %d wrote %d\n", RETVAL, ++ GetErrorString(RETVAL), s->stream.avail_in, ++s->stream.avail_out, done); */ ++ } + + if (trace) { + printf("DEFLATE returned %d %s, avail in %d, out %d\n", RETVAL, +@@ -1080,7 +1192,6 @@ flush(s, output, f=Z_FINISH) + CODE: + bufinc = s->bufsize; + +- s->stream.avail_in = 0; /* should be zero already anyway */ + + /* retrieve the output buffer */ + output = deRef_l(output, "flush") ; +@@ -1108,20 +1219,24 @@ flush(s, output, f=Z_FINISH) + /* Check for saved output from deflateParams */ + if (s->deflateParams_out_length) { + uLong plen = s->deflateParams_out_length ; +- /* printf("Copy %d bytes saved data\n", plen); */ ++ /* printf("Copy %lu bytes saved data\n", plen); */ + if (s->stream.avail_out < plen) { +- /* printf("GROW from %d to %d\n", s->stream.avail_out, ++ /* printf("GROW from %d to %lu\n", s->stream.avail_out, + SvLEN(output) + plen - s->stream.avail_out); */ +- Sv_Grow(output, SvLEN(output) + plen - s->stream.avail_out) ; ++ s->stream.next_out = (Bytef*) Sv_Grow(output, SvLEN(output) + plen - s->stream.avail_out) ; ++ s->stream.next_out += cur_length; + } + +- Copy(s->stream.next_out, s->deflateParams_out_buffer, plen, Bytef) ; +- cur_length = cur_length + plen; ++ Copy(s->deflateParams_out_buffer, s->stream.next_out, plen, Bytef) ; ++ cur_length += plen; + SvCUR_set(output, cur_length); +- s->stream.next_out += plen ; +- s->stream.avail_out = SvLEN(output) - cur_length ; +- increment = s->stream.avail_out; +- s->deflateParams_out_length = 0; ++ s->stream.next_out += plen ; ++ s->stream.avail_out = SvLEN(output) - cur_length ; ++ increment = s->stream.avail_out; ++ ++ s->deflateParams_out_length = 0; ++ Safefree(s->deflateParams_out_buffer); ++ s->deflateParams_out_buffer = NULL; + } + #endif + +@@ -1145,9 +1260,15 @@ flush(s, output, f=Z_FINISH) + } + + RETVAL = deflate(&(s->stream), f); ++ if (RETVAL != Z_STREAM_ERROR) { ++ int done = availableout - s->stream.avail_out ; ++ /* printf("flush DEFLATEr returned %d '%s' avail in %d, out %d wrote %d\n", RETVAL, ++ GetErrorString(RETVAL), s->stream.avail_in, ++s->stream.avail_out, done); */ ++ } + + if (trace) { +- printf("flush DEFLATE returned %d %s, avail in %d, out %d\n", RETVAL, ++ printf("flush DEFLATE returned %d '%s', avail in %d, out %d\n", RETVAL, + GetErrorString(RETVAL), s->stream.avail_in, s->stream.avail_out); + DispStream(s, "AFTER"); + } +@@ -1184,41 +1305,38 @@ _deflateParams(s, flags, level, strategy + int level + int strategy + uLong bufsize ++ bool changed = FALSE; + CODE: +- /* printf("_deflateParams(Flags %d Level %d Strategy %d Bufsize %d)\n", flags, level, strategy, bufsize); +- printf("Before -- Level %d, Strategy %d, Bufsize %d\n", s->Level, s->Strategy, s->bufsize); */ +- if (flags & 1) +- s->Level = level ; +- if (flags & 2) +- s->Strategy = strategy ; +- if (flags & 4) { ++ /* printf("_deflateParams(Flags %d Level %d Strategy %d Bufsize %d)\n", flags, level, strategy, bufsize); ++ printf("Before -- Level %d, Strategy %d, Bufsize %d\n", s->Level, s->Strategy, s->bufsize); */ ++ if (flags & 1 && level != s->Level) { ++ s->Level = level ; ++ changed = TRUE; ++ } ++ if (flags & 2 && strategy != s->Strategy) { ++ s->Strategy = strategy ; ++ changed = TRUE; ++ } ++ if (flags & 4) + s->bufsize = bufsize; +- } +- /* printf("After -- Level %d, Strategy %d, Bufsize %d\n", s->Level, s->Strategy, s->bufsize);*/ ++ if (changed) { + #ifdef SETP_BYTE +- s->stream.avail_in = 0; +- s->stream.next_out = &(s->deflateParams_out_byte) ; +- s->stream.avail_out = 1; +- RETVAL = deflateParams(&(s->stream), s->Level, s->Strategy); +- s->deflateParams_out_valid = +- (RETVAL == Z_OK && s->stream.avail_out == 0) ; +- /* printf("RETVAL %d, avail out %d, byte %c\n", RETVAL, s->stream.avail_out, s->deflateParams_out_byte); */ ++ s->stream.avail_in = 0; ++ s->stream.next_out = &(s->deflateParams_out_byte) ; ++ s->stream.avail_out = 1; ++ RETVAL = deflateParams(&(s->stream), s->Level, s->Strategy); ++ s->deflateParams_out_valid = ++ (RETVAL == Z_OK && s->stream.avail_out == 0) ; + #else +- /* printf("Level %d Strategy %d, Prev Len %d\n", ++ /* printf("Level %d Strategy %d, Prev Len %d\n", + s->Level, s->Strategy, s->deflateParams_out_length); */ +- s->stream.avail_in = 0; +- if (s->deflateParams_out_buffer == NULL) +- s->deflateParams_out_buffer = safemalloc(deflateParams_BUFFER_SIZE); +- s->stream.next_out = s->deflateParams_out_buffer ; +- s->stream.avail_out = deflateParams_BUFFER_SIZE; +- +- RETVAL = deflateParams(&(s->stream), s->Level, s->Strategy); +- s->deflateParams_out_length = deflateParams_BUFFER_SIZE - s->stream.avail_out; +- /* printf("RETVAL %d, length out %d, avail %d\n", +- RETVAL, s->deflateParams_out_length, s->stream.avail_out ); */ ++ RETVAL = flushParams(s); + #endif ++ } ++ else ++ RETVAL = Z_OK; + OUTPUT: +- RETVAL ++ RETVAL + + + int +Index: perl-5.24.1/cpan/Compress-Raw-Zlib/t/02zlib.t +=================================================================== +--- perl-5.24.1.orig/cpan/Compress-Raw-Zlib/t/02zlib.t ++++ perl-5.24.1/cpan/Compress-Raw-Zlib/t/02zlib.t +@@ -27,7 +27,7 @@ BEGIN + $count = 232 ; + } + elsif ($] >= 5.006) { +- $count = 317 ; ++ $count = 320 ; + } + else { + $count = 275 ; +@@ -559,6 +559,13 @@ SKIP: + is $x->get_Level(), Z_BEST_SPEED; + is $x->get_Strategy(), Z_HUFFMAN_ONLY; + ++ # change both Level & Strategy again without any calls to deflate ++ $status = $x->deflateParams(-Level => Z_DEFAULT_COMPRESSION, -Strategy => Z_DEFAULT_STRATEGY, -Bufsize => 1234) ; ++ cmp_ok $status, '==', Z_OK ; ++ ++ is $x->get_Level(), Z_DEFAULT_COMPRESSION; ++ is $x->get_Strategy(), Z_DEFAULT_STRATEGY; ++ + $status = $x->deflate($goodbye, $Answer) ; + cmp_ok $status, '==', Z_OK ; + $input .= $goodbye; +@@ -568,7 +575,7 @@ SKIP: + cmp_ok $status, '==', Z_OK ; + + is $x->get_Level(), Z_NO_COMPRESSION; +- is $x->get_Strategy(), Z_HUFFMAN_ONLY; ++ is $x->get_Strategy(), Z_DEFAULT_STRATEGY; + + $status = $x->deflate($goodbye, $Answer) ; + cmp_ok $status, '==', Z_OK ; +Index: perl-5.24.1/cpan/Compress-Raw-Zlib/t/compress/CompTestUtils.pm +=================================================================== +--- perl-5.24.1.orig/cpan/Compress-Raw-Zlib/t/compress/CompTestUtils.pm ++++ perl-5.24.1/cpan/Compress-Raw-Zlib/t/compress/CompTestUtils.pm +@@ -70,8 +70,8 @@ BEGIN { + + our ($index); + $index = '00000'; +- our ($useTempFile) = defined &File::Temp::tempdir; +- our ($useTempDir) = defined &File::Temp::newdir; ++ our ($useTempFile); ++ our ($useTempDir); + + sub new + { +Index: perl-5.24.1/cpan/Compress-Raw-Zlib/zlib-src/inflate.c +=================================================================== +--- perl-5.24.1.orig/cpan/Compress-Raw-Zlib/zlib-src/inflate.c ++++ perl-5.24.1/cpan/Compress-Raw-Zlib/zlib-src/inflate.c +@@ -1494,6 +1494,7 @@ int ZEXPORT inflateUndermine( + state->sane = !subvert; + return Z_OK; + #else ++ (void)subvert; + state->sane = 1; + return Z_DATA_ERROR; + #endif diff --git a/perl.changes b/perl.changes index 4d77915..6e8500f 100644 --- a/perl.changes +++ b/perl.changes @@ -1,3 +1,11 @@ +------------------------------------------------------------------- +Thu May 18 13:36:24 UTC 2017 - tchvatal@suse.com + +- Remove patch from previous commit, does not work: + * Compress-Raw-Zlib-2.071-Adapt-tests-to-zlib-1.2.11.patch +- Add patch taken from upstream release instead: + * Compress-Raw-Zlib-2.071-zlib-1.2.11.patch + ------------------------------------------------------------------- Wed May 10 13:52:26 UTC 2017 - mpluskal@suse.com diff --git a/perl.spec b/perl.spec index c4229bc..f61566b 100644 --- a/perl.spec +++ b/perl.spec @@ -44,7 +44,7 @@ Patch11: perl-5.18.2-overflow.diff # PATCH-FIX-UPSTREAM Fix a warning in cop.h , upstream commit f2b9631d5d19d2b71c1776e1193173d13f3620bf Patch12: perl-avoid-warnings.patch # PATCH-FIX-UPSTREAM RT#119762 -Patch13: Compress-Raw-Zlib-2.071-Adapt-tests-to-zlib-1.2.11.patch +Patch13: Compress-Raw-Zlib-2.071-zlib-1.2.11.patch BuildRoot: %{_tmppath}/%{name}-%{version}-build PreReq: perl-base = %version #PreReq: %fillup_prereq @@ -187,7 +187,7 @@ cp -p %{S:3} . %patch9 %patch11 %patch12 -p1 -%patch13 +%patch13 -p1 %build cp -a lib savelib