From 8bad623e4b15723c47418f65671f9f2b89e91f67 Mon Sep 17 00:00:00 2001 From: tb Date: Wed, 10 Aug 2022 07:50:16 +0000 Subject: [PATCH] Build the Compress::Raw::Zlib perl module with /usr/lib/libz Two actively used copies of zlib in base are enough. This simplifies handling security fixes. Now that zlib.h r1.7 is reverted, zlib ffi works fine on 32-bit architectures. Compared with an earlier attempt in March, this disables the Z_SOLO build option (problem found by gkoehler) and fixes two regress tests to work with zlib 1.2.12. Corresponding upstream commits: https://github.com/pmqs/Compress-Raw-Zlib/commit/c44e0b732e214b7f77d42a3af6ae64e https://github.com/pmqs/Compress-Raw-Zlib/commit/f47ea5f36c40fe19efe404dd75fd790 ok bluhm --- .../perl/cpan/Compress-Raw-Zlib/Makefile.PL | 2 +- .../perl/cpan/Compress-Raw-Zlib/config.in | 6 ++--- .../perl/cpan/Compress-Raw-Zlib/t/02zlib.t | 27 ++++++++++++++++--- 3 files changed, 27 insertions(+), 8 deletions(-) diff --git a/gnu/usr.bin/perl/cpan/Compress-Raw-Zlib/Makefile.PL b/gnu/usr.bin/perl/cpan/Compress-Raw-Zlib/Makefile.PL index 67c28d606f7..20c8cd01d0a 100644 --- a/gnu/usr.bin/perl/cpan/Compress-Raw-Zlib/Makefile.PL +++ b/gnu/usr.bin/perl/cpan/Compress-Raw-Zlib/Makefile.PL @@ -75,7 +75,7 @@ WriteMakefile( NAME => 'Compress::Raw::Zlib', VERSION_FROM => 'lib/Compress/Raw/Zlib.pm', INC => "-I$ZLIB_INCLUDE" , - DEFINE => "-DNO_VIZ -DZ_SOLO $OLD_ZLIB $WALL -DGZIP_OS_CODE=$GZIP_OS_CODE $USE_PPPORT_H" , + DEFINE => "-DNO_VIZ $OLD_ZLIB $WALL -DGZIP_OS_CODE=$GZIP_OS_CODE $USE_PPPORT_H" , XS => { 'Zlib.xs' => 'Zlib.c'}, 'depend' => { 'Makefile' => 'config.in' }, 'clean' => { FILES => '*.c constants.h constants.xs' }, diff --git a/gnu/usr.bin/perl/cpan/Compress-Raw-Zlib/config.in b/gnu/usr.bin/perl/cpan/Compress-Raw-Zlib/config.in index d6701ffb0cf..30d14a6b220 100644 --- a/gnu/usr.bin/perl/cpan/Compress-Raw-Zlib/config.in +++ b/gnu/usr.bin/perl/cpan/Compress-Raw-Zlib/config.in @@ -16,9 +16,9 @@ # Setting the Gzip OS Code # -BUILD_ZLIB = True -INCLUDE = ./zlib-src -LIB = ./zlib-src +BUILD_ZLIB = False +INCLUDE = /usr/include +LIB = /usr/lib OLD_ZLIB = False GZIP_OS_CODE = AUTO_DETECT diff --git a/gnu/usr.bin/perl/cpan/Compress-Raw-Zlib/t/02zlib.t b/gnu/usr.bin/perl/cpan/Compress-Raw-Zlib/t/02zlib.t index d7cd513af1e..3cc762ec9f2 100755 --- a/gnu/usr.bin/perl/cpan/Compress-Raw-Zlib/t/02zlib.t +++ b/gnu/usr.bin/perl/cpan/Compress-Raw-Zlib/t/02zlib.t @@ -13,6 +13,7 @@ use bytes; use Test::More ; use CompTestUtils; +use constant ZLIB_1_2_12_0 => 0x12C0; BEGIN { @@ -489,10 +490,18 @@ SKIP: # print "x $status\n"; last if $status == Z_STREAM_END or $status != Z_OK ; } - - cmp_ok $status, '==', Z_DATA_ERROR ; - is $GOT, $goodbye ; + # Z_STREAM_END returned by 1.12.2, Z_DATA_ERROR for older zlib + if (ZLIB_VERNUM >= ZLIB_1_2_12_0) + { + cmp_ok $status, '==', Z_STREAM_END ; + } + else + { + cmp_ok $status, '==', Z_DATA_ERROR ; + } + + is $GOT, $goodbye ; # Check inflateSync leaves good data in buffer my $rest = $Answer ; @@ -514,7 +523,17 @@ SKIP: is length($rest), $len2, "expected compressed output"; $GOT = ''; - cmp_ok $k->inflate($rest, $GOT), '==', Z_DATA_ERROR, "inflate returns Z_DATA_ERROR"; + $status = $k->inflate($rest, $GOT); + # Z_STREAM_END returned by 1.12.2, Z_DATA_ERROR for older zlib + if (ZLIB_VERNUM >= ZLIB_1_2_12_0) + { + cmp_ok $status, '==', Z_STREAM_END ; + } + else + { + cmp_ok $status, '==', Z_DATA_ERROR ; + } + is $GOT, $goodbye ; } -- 2.20.1