diff options
author | Chris 'BinGOs' Williams <chris@bingosnet.co.uk> | 2011-11-06 22:56:39 +0000 |
---|---|---|
committer | Chris 'BinGOs' Williams <chris@bingosnet.co.uk> | 2011-11-06 23:49:04 +0000 |
commit | ad4795e78e923065898354b946437030aaeca163 (patch) | |
tree | 7ba5c1b856e45166575626fbef0c4a23026600c0 | |
parent | 00d0325cf674c5cfc5ea2c9eb9917de7a8265763 (diff) | |
download | perl-ad4795e78e923065898354b946437030aaeca163.tar.gz |
Update IO-Compress to CPAN version 2.040
[DELTA]
2.040 28 October 2011
* t/105oneshot-zip-only.t
- CanonicalName test failure on Windows
[RT# 68926]
* IO::Compress::Zip
- ExtAttr now populates MSDOS attributes
2.039 28 October 2011
* IO::Compress::Zip
- Added CanonicalName option.
Note this option is set to true by default.
- Added FilterName option
* IO::Unompress::Base
- Fixed issue where setting $\ would corrupt the uncompressed data.
Thanks to Steffen Goeldner for reporting the issue.
* t/050interop-*.t
- Handle case when external command contains a whitespace
RT #71335
37 files changed, 408 insertions, 158 deletions
diff --git a/Porting/Maintainers.pl b/Porting/Maintainers.pl index dce34791d8..c1d3d2d1c4 100755 --- a/Porting/Maintainers.pl +++ b/Porting/Maintainers.pl @@ -1034,7 +1034,7 @@ use File::Glob qw(:case); 'IO-Compress' => { 'MAINTAINER' => 'pmqs', - 'DISTRIBUTION' => 'PMQS/IO-Compress-2.037.tar.gz', + 'DISTRIBUTION' => 'PMQS/IO-Compress-2.040.tar.gz', 'FILES' => q[cpan/IO-Compress], 'EXCLUDED' => [ qr{t/Test/} ], 'UPSTREAM' => 'cpan', diff --git a/cpan/IO-Compress/Changes b/cpan/IO-Compress/Changes index 675689c9cd..b71ee2ff68 100644 --- a/cpan/IO-Compress/Changes +++ b/cpan/IO-Compress/Changes @@ -1,6 +1,30 @@ CHANGES ------- + 2.040 28 October 2011 + + * t/105oneshot-zip-only.t + - CanonicalName test failure on Windows + [RT# 68926] + + * IO::Compress::Zip + - ExtAttr now populates MSDOS attributes + + 2.039 28 October 2011 + + * IO::Compress::Zip + - Added CanonicalName option. + Note this option is set to true by default. + - Added FilterName option + + * IO::Unompress::Base + - Fixed issue where setting $\ would corrupt the uncompressed data. + Thanks to Steffen Goeldner for reporting the issue. + + * t/050interop-*.t + - Handle case when external command contains a whitespace + RT #71335 + 2.037 22 June 2011 * IO::Uncompress diff --git a/cpan/IO-Compress/Makefile.PL b/cpan/IO-Compress/Makefile.PL index 3cb62725a8..8d4f391333 100644 --- a/cpan/IO-Compress/Makefile.PL +++ b/cpan/IO-Compress/Makefile.PL @@ -3,7 +3,7 @@ use strict ; require 5.004 ; -$::VERSION = '2.037' ; +$::VERSION = '2.040' ; use private::MakeUtil; use ExtUtils::MakeMaker 5.16 ; diff --git a/cpan/IO-Compress/README b/cpan/IO-Compress/README index 6f51a805b8..6ce4705ffb 100644 --- a/cpan/IO-Compress/README +++ b/cpan/IO-Compress/README @@ -1,9 +1,9 @@ IO-Compress - Version 2.037 + Version 2.040 - 22nd June 2011 + 28th october 2011 Copyright (c) 1995-2011 Paul Marquess. All rights reserved. This program is free software; you can redistribute it @@ -89,7 +89,7 @@ To help me help you, I need all of the following information: If you haven't installed IO-Compress then search IO::Compress::Gzip.pm for a line like this: - $VERSION = "2.037" ; + $VERSION = "2.040" ; 2. If you are having problems building IO-Compress, send me a complete log of what happened. Start by unpacking the IO-Compress diff --git a/cpan/IO-Compress/lib/Compress/Zlib.pm b/cpan/IO-Compress/lib/Compress/Zlib.pm index 5c19ccb523..9051218ae2 100644 --- a/cpan/IO-Compress/lib/Compress/Zlib.pm +++ b/cpan/IO-Compress/lib/Compress/Zlib.pm @@ -7,17 +7,17 @@ use Carp ; use IO::Handle ; use Scalar::Util qw(dualvar); -use IO::Compress::Base::Common 2.037 ; -use Compress::Raw::Zlib 2.037 ; -use IO::Compress::Gzip 2.037 ; -use IO::Uncompress::Gunzip 2.037 ; +use IO::Compress::Base::Common 2.040 ; +use Compress::Raw::Zlib 2.040 ; +use IO::Compress::Gzip 2.040 ; +use IO::Uncompress::Gunzip 2.040 ; use strict ; use warnings ; use bytes ; our ($VERSION, $XS_VERSION, @ISA, @EXPORT, @EXPORT_OK, %EXPORT_TAGS); -$VERSION = '2.037'; +$VERSION = '2.040'; $XS_VERSION = $VERSION; $VERSION = eval $VERSION; @@ -453,7 +453,7 @@ sub inflate package Compress::Zlib ; -use IO::Compress::Gzip::Constants 2.037 ; +use IO::Compress::Gzip::Constants 2.040 ; sub memGzip($) { diff --git a/cpan/IO-Compress/lib/IO/Compress/Adapter/Bzip2.pm b/cpan/IO-Compress/lib/IO/Compress/Adapter/Bzip2.pm index ca351e2b96..ec4daa158a 100644 --- a/cpan/IO-Compress/lib/IO/Compress/Adapter/Bzip2.pm +++ b/cpan/IO-Compress/lib/IO/Compress/Adapter/Bzip2.pm @@ -4,13 +4,13 @@ use strict; use warnings; use bytes; -use IO::Compress::Base::Common 2.037 qw(:Status); +use IO::Compress::Base::Common 2.040 qw(:Status); #use Compress::Bzip2 ; -use Compress::Raw::Bzip2 2.037 ; +use Compress::Raw::Bzip2 2.040 ; our ($VERSION); -$VERSION = '2.037'; +$VERSION = '2.040'; sub mkCompObject { diff --git a/cpan/IO-Compress/lib/IO/Compress/Adapter/Deflate.pm b/cpan/IO-Compress/lib/IO/Compress/Adapter/Deflate.pm index 91e5843e9b..94f2ad28b5 100644 --- a/cpan/IO-Compress/lib/IO/Compress/Adapter/Deflate.pm +++ b/cpan/IO-Compress/lib/IO/Compress/Adapter/Deflate.pm @@ -4,12 +4,12 @@ use strict; use warnings; use bytes; -use IO::Compress::Base::Common 2.037 qw(:Status); +use IO::Compress::Base::Common 2.040 qw(:Status); -use Compress::Raw::Zlib 2.037 qw(Z_OK Z_FINISH MAX_WBITS) ; +use Compress::Raw::Zlib 2.040 qw(Z_OK Z_FINISH MAX_WBITS) ; our ($VERSION); -$VERSION = '2.037'; +$VERSION = '2.040'; sub mkCompObject { diff --git a/cpan/IO-Compress/lib/IO/Compress/Adapter/Identity.pm b/cpan/IO-Compress/lib/IO/Compress/Adapter/Identity.pm index c48c8883a2..ef040fa014 100644 --- a/cpan/IO-Compress/lib/IO/Compress/Adapter/Identity.pm +++ b/cpan/IO-Compress/lib/IO/Compress/Adapter/Identity.pm @@ -4,10 +4,10 @@ use strict; use warnings; use bytes; -use IO::Compress::Base::Common 2.037 qw(:Status); +use IO::Compress::Base::Common 2.040 qw(:Status); our ($VERSION); -$VERSION = '2.037'; +$VERSION = '2.040'; sub mkCompObject { diff --git a/cpan/IO-Compress/lib/IO/Compress/Base.pm b/cpan/IO-Compress/lib/IO/Compress/Base.pm index 6f491f668e..f0690daeab 100644 --- a/cpan/IO-Compress/lib/IO/Compress/Base.pm +++ b/cpan/IO-Compress/lib/IO/Compress/Base.pm @@ -6,7 +6,7 @@ require 5.004 ; use strict ; use warnings; -use IO::Compress::Base::Common 2.037 ; +use IO::Compress::Base::Common 2.040 ; use IO::File qw(SEEK_SET SEEK_END); ; use Scalar::Util qw(blessed readonly); @@ -20,7 +20,7 @@ use bytes; our (@ISA, $VERSION); @ISA = qw(Exporter IO::File); -$VERSION = '2.037'; +$VERSION = '2.040'; #Can't locate object method "SWASHNEW" via package "utf8" (perhaps you forgot to load "utf8"?) at .../ext/Compress-Zlib/Gzip/blib/lib/Compress/Zlib/Common.pm line 16. @@ -123,9 +123,9 @@ sub output return 1 if length $data == 0 && ! $last ; - if ( *$self->{FilterEnvelope} ) { + if ( *$self->{FilterContainer} ) { *_ = \$data; - &{ *$self->{FilterEnvelope} }(); + &{ *$self->{FilterContainer} }(); } if (length $data) { @@ -163,7 +163,7 @@ sub checkParams 'Append' => [1, 1, Parse_boolean, 0], 'BinModeIn' => [1, 1, Parse_boolean, 0], - 'FilterEnvelope' => [1, 1, Parse_any, undef], + 'FilterContainer' => [1, 1, Parse_code, undef], $self->getExtraParams(), *$self->{OneShot} ? $self->getOneShotParams() @@ -214,7 +214,7 @@ sub _create my $merge = $got->value('Merge') ; my $appendOutput = $got->value('Append') || $merge ; *$obj->{Append} = $appendOutput; - *$obj->{FilterEnvelope} = $got->value('FilterEnvelope') ; + *$obj->{FilterContainer} = $got->value('FilterContainer') ; if ($merge) { diff --git a/cpan/IO-Compress/lib/IO/Compress/Base/Common.pm b/cpan/IO-Compress/lib/IO/Compress/Base/Common.pm index b6d3342619..a78800798a 100644 --- a/cpan/IO-Compress/lib/IO/Compress/Base/Common.pm +++ b/cpan/IO-Compress/lib/IO/Compress/Base/Common.pm @@ -11,7 +11,7 @@ use File::GlobMapper; require Exporter; our ($VERSION, @ISA, @EXPORT, %EXPORT_TAGS, $HAS_ENCODE); @ISA = qw(Exporter); -$VERSION = '2.037'; +$VERSION = '2.040'; @EXPORT = qw( isaFilehandle isaFilename whatIsInput whatIsOutput isaFileGlobString cleanFileGlobString oneTarget @@ -451,7 +451,8 @@ sub createSelfTiedObject $EXPORT_TAGS{Parse} = [qw( ParseParameters Parse_any Parse_unsigned Parse_signed - Parse_boolean Parse_custom Parse_string + Parse_boolean Parse_string + Parse_code Parse_multiple Parse_writable_scalar ) ]; @@ -463,7 +464,7 @@ use constant Parse_unsigned => 0x02; use constant Parse_signed => 0x04; use constant Parse_boolean => 0x08; use constant Parse_string => 0x10; -use constant Parse_custom => 0x12; +use constant Parse_code => 0x20; #use constant Parse_store_ref => 0x100 ; use constant Parse_multiple => 0x100 ; @@ -741,6 +742,13 @@ sub IO::Compress::Base::Parameters::_checkType $$output = defined $value ? $value != 0 : 0 ; return 1; } + elsif ($type & Parse_code) + { + return $self->setError("Parameter '$key' must be a code reference, got '$value'") + if $validate && (! defined $value || ref $value ne 'CODE') ; + $$output = defined $value ? $value : "" ; + return 1; + } elsif ($type & Parse_string) { $$output = defined $value ? $value : "" ; @@ -937,7 +945,7 @@ sub subtract if ($value > $self->[LOW]) { -- $self->[HIGH] ; - $self->[LOW] = MAX32 - $self->[LOW] ; + $self->[LOW] = MAX32 - $value + $self->[LOW] + 1 ; } else { $self->[LOW] -= $value; diff --git a/cpan/IO-Compress/lib/IO/Compress/Bzip2.pm b/cpan/IO-Compress/lib/IO/Compress/Bzip2.pm index e4bb983f2d..9ff61ca833 100644 --- a/cpan/IO-Compress/lib/IO/Compress/Bzip2.pm +++ b/cpan/IO-Compress/lib/IO/Compress/Bzip2.pm @@ -5,16 +5,16 @@ use warnings; use bytes; require Exporter ; -use IO::Compress::Base 2.037 ; +use IO::Compress::Base 2.040 ; -use IO::Compress::Base::Common 2.037 qw(createSelfTiedObject); -use IO::Compress::Adapter::Bzip2 2.037 ; +use IO::Compress::Base::Common 2.040 qw(createSelfTiedObject); +use IO::Compress::Adapter::Bzip2 2.040 ; our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $Bzip2Error); -$VERSION = '2.037'; +$VERSION = '2.040'; $Bzip2Error = ''; @ISA = qw(Exporter IO::Compress::Base); @@ -51,7 +51,7 @@ sub getExtraParams { my $self = shift ; - use IO::Compress::Base::Common 2.037 qw(:Parse); + use IO::Compress::Base::Common 2.040 qw(:Parse); return ( 'BlockSize100K' => [0, 1, Parse_unsigned, 1], diff --git a/cpan/IO-Compress/lib/IO/Compress/Deflate.pm b/cpan/IO-Compress/lib/IO/Compress/Deflate.pm index f2f0ce97a1..a29e0e2d12 100644 --- a/cpan/IO-Compress/lib/IO/Compress/Deflate.pm +++ b/cpan/IO-Compress/lib/IO/Compress/Deflate.pm @@ -6,16 +6,16 @@ use bytes; require Exporter ; -use IO::Compress::RawDeflate 2.037 ; +use IO::Compress::RawDeflate 2.040 ; -use Compress::Raw::Zlib 2.037 ; -use IO::Compress::Zlib::Constants 2.037 ; -use IO::Compress::Base::Common 2.037 qw(createSelfTiedObject); +use Compress::Raw::Zlib 2.040 ; +use IO::Compress::Zlib::Constants 2.040 ; +use IO::Compress::Base::Common 2.040 qw(createSelfTiedObject); our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $DeflateError); -$VERSION = '2.037'; +$VERSION = '2.040'; $DeflateError = ''; @ISA = qw(Exporter IO::Compress::RawDeflate); diff --git a/cpan/IO-Compress/lib/IO/Compress/Gzip.pm b/cpan/IO-Compress/lib/IO/Compress/Gzip.pm index 343d87fbdd..5835961e74 100644 --- a/cpan/IO-Compress/lib/IO/Compress/Gzip.pm +++ b/cpan/IO-Compress/lib/IO/Compress/Gzip.pm @@ -8,12 +8,12 @@ use warnings; use bytes; -use IO::Compress::RawDeflate 2.037 ; +use IO::Compress::RawDeflate 2.040 ; -use Compress::Raw::Zlib 2.037 ; -use IO::Compress::Base::Common 2.037 qw(:Status :Parse createSelfTiedObject); -use IO::Compress::Gzip::Constants 2.037 ; -use IO::Compress::Zlib::Extra 2.037 ; +use Compress::Raw::Zlib 2.040 ; +use IO::Compress::Base::Common 2.040 qw(:Status :Parse createSelfTiedObject); +use IO::Compress::Gzip::Constants 2.040 ; +use IO::Compress::Zlib::Extra 2.040 ; BEGIN { @@ -27,7 +27,7 @@ require Exporter ; our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $GzipError); -$VERSION = '2.037'; +$VERSION = '2.040'; $GzipError = '' ; @ISA = qw(Exporter IO::Compress::RawDeflate); diff --git a/cpan/IO-Compress/lib/IO/Compress/Gzip/Constants.pm b/cpan/IO-Compress/lib/IO/Compress/Gzip/Constants.pm index 918f3d21a3..65aff3c9c6 100644 --- a/cpan/IO-Compress/lib/IO/Compress/Gzip/Constants.pm +++ b/cpan/IO-Compress/lib/IO/Compress/Gzip/Constants.pm @@ -9,7 +9,7 @@ require Exporter; our ($VERSION, @ISA, @EXPORT, %GZIP_OS_Names); our ($GZIP_FNAME_INVALID_CHAR_RE, $GZIP_FCOMMENT_INVALID_CHAR_RE); -$VERSION = '2.037'; +$VERSION = '2.040'; @ISA = qw(Exporter); diff --git a/cpan/IO-Compress/lib/IO/Compress/RawDeflate.pm b/cpan/IO-Compress/lib/IO/Compress/RawDeflate.pm index 4c7548882e..f4c519db1b 100644 --- a/cpan/IO-Compress/lib/IO/Compress/RawDeflate.pm +++ b/cpan/IO-Compress/lib/IO/Compress/RawDeflate.pm @@ -7,16 +7,16 @@ use warnings; use bytes; -use IO::Compress::Base 2.037 ; -use IO::Compress::Base::Common 2.037 qw(:Status createSelfTiedObject); -use IO::Compress::Adapter::Deflate 2.037 ; +use IO::Compress::Base 2.040 ; +use IO::Compress::Base::Common 2.040 qw(:Status createSelfTiedObject); +use IO::Compress::Adapter::Deflate 2.040 ; require Exporter ; our ($VERSION, @ISA, @EXPORT_OK, %DEFLATE_CONSTANTS, %EXPORT_TAGS, $RawDeflateError); -$VERSION = '2.037'; +$VERSION = '2.040'; $RawDeflateError = ''; @ISA = qw(Exporter IO::Compress::Base); @@ -142,8 +142,8 @@ sub getZlibParams { my $self = shift ; - use IO::Compress::Base::Common 2.037 qw(:Parse); - use Compress::Raw::Zlib 2.037 qw(Z_DEFLATED Z_DEFAULT_COMPRESSION Z_DEFAULT_STRATEGY); + use IO::Compress::Base::Common 2.040 qw(:Parse); + use Compress::Raw::Zlib 2.040 qw(Z_DEFLATED Z_DEFAULT_COMPRESSION Z_DEFAULT_STRATEGY); return ( diff --git a/cpan/IO-Compress/lib/IO/Compress/Zip.pm b/cpan/IO-Compress/lib/IO/Compress/Zip.pm index 55588c0a34..1971bcb591 100644 --- a/cpan/IO-Compress/lib/IO/Compress/Zip.pm +++ b/cpan/IO-Compress/lib/IO/Compress/Zip.pm @@ -4,26 +4,27 @@ use strict ; use warnings; use bytes; -use IO::Compress::Base::Common 2.037 qw(:Status createSelfTiedObject); -use IO::Compress::RawDeflate 2.037 ; -use IO::Compress::Adapter::Deflate 2.037 ; -use IO::Compress::Adapter::Identity 2.037 ; -use IO::Compress::Zlib::Extra 2.037 ; -use IO::Compress::Zip::Constants 2.037 ; +use IO::Compress::Base::Common 2.040 qw(:Status createSelfTiedObject); +use IO::Compress::RawDeflate 2.040 ; +use IO::Compress::Adapter::Deflate 2.040 ; +use IO::Compress::Adapter::Identity 2.040 ; +use IO::Compress::Zlib::Extra 2.040 ; +use IO::Compress::Zip::Constants 2.040 ; +use File::Spec(); -use Compress::Raw::Zlib 2.037 qw(crc32) ; +use Compress::Raw::Zlib 2.040 qw(crc32) ; BEGIN { eval { require IO::Compress::Adapter::Bzip2 ; - import IO::Compress::Adapter::Bzip2 2.037 ; + import IO::Compress::Adapter::Bzip2 2.040 ; require IO::Compress::Bzip2 ; - import IO::Compress::Bzip2 2.037 ; + import IO::Compress::Bzip2 2.040 ; } ; eval { require IO::Compress::Adapter::Lzma ; import IO::Compress::Adapter::Lzma 2.036 ; require IO::Compress::Lzma ; - import IO::Compress::Lzma 2.037 ; + import IO::Compress::Lzma 2.040 ; } ; } @@ -32,7 +33,7 @@ require Exporter ; our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $ZipError); -$VERSION = '2.037'; +$VERSION = '2.040'; $ZipError = ''; @ISA = qw(Exporter IO::Compress::RawDeflate); @@ -155,6 +156,52 @@ sub filterUncompressed } } +sub canonicalName +{ + # This sub is derived from Archive::Zip::_asZipDirName + + # Return the normalized name as used in a zip file (path + # separators become slashes, etc.). + # Will translate internal slashes in path components (i.e. on Macs) to + # underscores. Discards volume names. + # When $forceDir is set, returns paths with trailing slashes + # + # input output + # . '.' + # ./a a + # ./a/b a/b + # ./a/b/ a/b + # a/b/ a/b + # /a/b/ a/b + # c:\a\b\c.doc a/b/c.doc # on Windows + # "i/o maps:whatever" i_o maps/whatever # on Macs + + my $name = shift; + my $forceDir = shift ; + + my ( $volume, $directories, $file ) = + File::Spec->splitpath( File::Spec->canonpath($name), $forceDir ); + + my @dirs = map { $_ =~ s{/}{_}g; $_ } + File::Spec->splitdir($directories); + + if ( @dirs > 0 ) { pop (@dirs) if $dirs[-1] eq '' } # remove empty component + push @dirs, defined($file) ? $file : '' ; + + my $normalised_path = join '/', @dirs; + + # Leading directory separators should not be stored in zip archives. + # Example: + # C:\a\b\c\ a/b/c + # C:\a\b\c.txt a/b/c.txt + # /a/b/c/ a/b/c + # /a/b/c.txt a/b/c.txt + $normalised_path =~ s{^/}{}; # remove leading separator + + return $normalised_path; +} + + sub mkHeader { my $self = shift; @@ -163,11 +210,27 @@ sub mkHeader *$self->{ZipData}{LocalHdrOffset} = U64::clone(*$self->{ZipData}{Offset}); + my $comment = ''; + $comment = $param->value('Comment') || ''; + my $filename = ''; $filename = $param->value('Name') || ''; - my $comment = ''; - $comment = $param->value('Comment') || ''; + $filename = canonicalName($filename) + if length $filename && $param->value('CanonicalName') ; + + if (defined *$self->{ZipData}{FilterName} ) { + local *_ = \$filename ; + &{ *$self->{ZipData}{FilterName} }() ; + } + +# if ( $param->value('UTF8') ) { +# require Encode ; +# $filename = Encode::encode_utf8($filename) +# if length $filename ; +# $comment = Encode::encode_utf8($filename) +# if length $comment ; +# } my $hdr = ''; @@ -226,6 +289,9 @@ sub mkHeader $gpFlag |= ZIP_GP_FLAG_LZMA_EOS_PRESENT if $method == ZIP_CM_LZMA ; + #$gpFlag |= ZIP_GP_FLAG_LANGUAGE_ENCODING + #if $param->value('UTF8') && length($filename) + length($comment); + my $version = $ZIP_CM_MIN_VERSIONS{$method}; $version = ZIP64_MIN_VERSION @@ -532,6 +598,12 @@ sub ckParams *$self->{ZipData}{Method} = ZIP_CM_STORE; } + if ($got->parsed('FilterName')) { + my $v = $got->value('FilterName') ; + *$self->{ZipData}{FilterName} = $v + if ref $v eq 'CODE' ; + } + return 1 ; } @@ -554,8 +626,8 @@ sub getExtraParams { my $self = shift ; - use IO::Compress::Base::Common 2.037 qw(:Parse); - use Compress::Raw::Zlib 2.037 qw(Z_DEFLATED Z_DEFAULT_COMPRESSION Z_DEFAULT_STRATEGY); + use IO::Compress::Base::Common 2.040 qw(:Parse); + use Compress::Raw::Zlib 2.040 qw(Z_DEFLATED Z_DEFAULT_COMPRESSION Z_DEFAULT_STRATEGY); my @Bzip2 = (); @@ -577,6 +649,9 @@ sub getExtraParams 'Comment' => [0, 1, Parse_any, ''], 'ZipComment'=> [0, 1, Parse_any, ''], 'Name' => [0, 1, Parse_any, ''], + 'FilterName'=> [0, 1, Parse_code, undef], + 'CanonicalName'=> [0, 1, Parse_boolean, 1], + #'UTF8' => [0, 1, Parse_boolean, 0], 'Time' => [0, 1, Parse_any, undef], 'exTime' => [0, 1, Parse_any, undef], 'exUnix2' => [0, 1, Parse_any, undef], @@ -631,8 +706,15 @@ sub getFileInfo } # NOTE - Unix specific code alert - $params->value('ExtAttr' => $mode << 16) - if ! $params->parsed('ExtAttr'); + if (! $params->parsed('ExtAttr')) + { + use Fcntl qw(:mode) ; + my $attr = $mode << 16; + $attr |= ZIP_A_RONLY if ($mode & S_IWRITE) == 0 ; + $attr |= ZIP_A_DIR if ($mode & S_IFMT ) == S_IFDIR ; + + $params->value('ExtAttr' => $attr); + } $params->value('UID' => $uid) ; $params->value('GID' => $gid) ; @@ -1112,12 +1194,67 @@ This parameter defaults to 0. Stores the contents of C<$string> in the zip filename header field. -If C<Name> is not specified and the C<$input> parameter is a filename that -will be used for the zip filename header field. +If C<Name> is not specified and the C<$input> parameter is a filename, the +value of C<$input> will be used for the zip filename header field. If C<Name> is not specified and the C<$input> parameter is not a filename, no zip filename field will be created. +Note that both the C<CanonicalName> and C<FilterName> options +can modify the value used for the zip filename header field. + +=item C<< CanonicalName => 0|1 >> + +This option controls whether the filename field in the zip header is +I<normalized> into Unix format before being written to the zip file. + +It is recommended that you leave this option enabled unless you really need +to create a non-standard Zip file. + +This is what APPNOTE.TXT has to say on what should be stored in the zip +filename header field. + + The name of the file, with optional relative path. + The path stored should not contain a drive or + device letter, or a leading slash. All slashes + should be forward slashes '/' as opposed to + backwards slashes '\' for compatibility with Amiga + and UNIX file systems etc. + +This option defaults to B<true>. + +=item C<< FilterName => sub { ... } >> + +This option allow the filename field in the zip header to be modified +before it is written to the zip file. + +This option takes a parameter that must be a reference to a sub. On entry +to the sub the C<$_> variable will contain the name to be filtered. If no +filename is available C<$_> will contain an empty string. + +The value of C<$_> when the sub returns will be stored in the filename +header field. + +Note that if C<CanonicalName> is enabled (and it is by default), a +normalized filename will be passed to the sub. + +If you use C<FilterName> to modify the filename, it is your responsibility +to keep the filename in Unix format. + +Although this option can be used with the OO ointerface, it is of most use +with the one-shot interface. For example, the code below shows how +C<FilterName> can be used to remove the path component from a series of +filenames before they are stored in C<$zipfile>. + + sub compressTxtFiles + { + my $zipfile = shift ; + my $dir = shift ; + + zip [ <$dir/*.txt> ] => $zipfile, + FilterName => sub { s[^$dir/][] } ; + } + =item C<< Time => $number >> Sets the last modified time field in the zip header to $number. diff --git a/cpan/IO-Compress/lib/IO/Compress/Zip/Constants.pm b/cpan/IO-Compress/lib/IO/Compress/Zip/Constants.pm index 47fd75117e..82172bcc11 100644 --- a/cpan/IO-Compress/lib/IO/Compress/Zip/Constants.pm +++ b/cpan/IO-Compress/lib/IO/Compress/Zip/Constants.pm @@ -7,7 +7,7 @@ require Exporter; our ($VERSION, @ISA, @EXPORT, %ZIP_CM_MIN_VERSIONS); -$VERSION = '2.037'; +$VERSION = '2.040'; @ISA = qw(Exporter); @@ -51,6 +51,12 @@ $VERSION = '2.037'; %ZIP_CM_MIN_VERSIONS ZIP64_MIN_VERSION + ZIP_A_RONLY + ZIP_A_HIDDEN + ZIP_A_SYSTEM + ZIP_A_LABEL + ZIP_A_DIR + ZIP_A_ARCHIVE ); # Compression types supported @@ -94,13 +100,21 @@ use constant ZIP_EXTRA_ID_INFO_ZIP_Upath => "up"; use constant ZIP_EXTRA_ID_INFO_ZIP_Ucom => "uc"; use constant ZIP_EXTRA_ID_JAVA_EXE => pack "v", 0xCAFE; +# DOS Attributes +use constant ZIP_A_RONLY => 0x01; +use constant ZIP_A_HIDDEN => 0x02; +use constant ZIP_A_SYSTEM => 0x04; +use constant ZIP_A_LABEL => 0x08; +use constant ZIP_A_DIR => 0x10; +use constant ZIP_A_ARCHIVE => 0x20; + use constant ZIP64_MIN_VERSION => 45; %ZIP_CM_MIN_VERSIONS = ( - ZIP_CM_STORE() => 20, - ZIP_CM_DEFLATE() => 20, - ZIP_CM_BZIP2() => 46, - ZIP_CM_LZMA() => 63, + ZIP_CM_STORE() => 20, + ZIP_CM_DEFLATE() => 20, + ZIP_CM_BZIP2() => 46, + ZIP_CM_LZMA() => 63, ); diff --git a/cpan/IO-Compress/lib/IO/Compress/Zlib/Constants.pm b/cpan/IO-Compress/lib/IO/Compress/Zlib/Constants.pm index 4eeab80c7f..9342e58963 100644 --- a/cpan/IO-Compress/lib/IO/Compress/Zlib/Constants.pm +++ b/cpan/IO-Compress/lib/IO/Compress/Zlib/Constants.pm @@ -9,7 +9,7 @@ require Exporter; our ($VERSION, @ISA, @EXPORT); -$VERSION = '2.037'; +$VERSION = '2.040'; @ISA = qw(Exporter); diff --git a/cpan/IO-Compress/lib/IO/Compress/Zlib/Extra.pm b/cpan/IO-Compress/lib/IO/Compress/Zlib/Extra.pm index 66d0a2e5d9..96bd5aaad2 100644 --- a/cpan/IO-Compress/lib/IO/Compress/Zlib/Extra.pm +++ b/cpan/IO-Compress/lib/IO/Compress/Zlib/Extra.pm @@ -8,9 +8,9 @@ use bytes; our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS); -$VERSION = '2.037'; +$VERSION = '2.040'; -use IO::Compress::Gzip::Constants 2.037 ; +use IO::Compress::Gzip::Constants 2.040 ; sub ExtraFieldError { diff --git a/cpan/IO-Compress/lib/IO/Uncompress/Adapter/Bunzip2.pm b/cpan/IO-Compress/lib/IO/Uncompress/Adapter/Bunzip2.pm index 026627a18b..173a51dd38 100644 --- a/cpan/IO-Compress/lib/IO/Uncompress/Adapter/Bunzip2.pm +++ b/cpan/IO-Compress/lib/IO/Uncompress/Adapter/Bunzip2.pm @@ -4,12 +4,12 @@ use strict; use warnings; use bytes; -use IO::Compress::Base::Common 2.037 qw(:Status); +use IO::Compress::Base::Common 2.040 qw(:Status); -use Compress::Raw::Bzip2 2.037 ; +use Compress::Raw::Bzip2 2.040 ; our ($VERSION, @ISA); -$VERSION = '2.037'; +$VERSION = '2.040'; sub mkUncompObject { diff --git a/cpan/IO-Compress/lib/IO/Uncompress/Adapter/Identity.pm b/cpan/IO-Compress/lib/IO/Uncompress/Adapter/Identity.pm index 4d36999ba3..a4205fd9d6 100644 --- a/cpan/IO-Compress/lib/IO/Uncompress/Adapter/Identity.pm +++ b/cpan/IO-Compress/lib/IO/Uncompress/Adapter/Identity.pm @@ -4,14 +4,14 @@ use warnings; use strict; use bytes; -use IO::Compress::Base::Common 2.037 qw(:Status); +use IO::Compress::Base::Common 2.040 qw(:Status); use IO::Compress::Zip::Constants ; our ($VERSION); -$VERSION = '2.037'; +$VERSION = '2.040'; -use Compress::Raw::Zlib 2.037 (); +use Compress::Raw::Zlib 2.040 (); sub mkUncompObject { diff --git a/cpan/IO-Compress/lib/IO/Uncompress/Adapter/Inflate.pm b/cpan/IO-Compress/lib/IO/Uncompress/Adapter/Inflate.pm index ab7449608d..ed0d173618 100644 --- a/cpan/IO-Compress/lib/IO/Uncompress/Adapter/Inflate.pm +++ b/cpan/IO-Compress/lib/IO/Uncompress/Adapter/Inflate.pm @@ -4,11 +4,11 @@ use strict; use warnings; use bytes; -use IO::Compress::Base::Common 2.037 qw(:Status); -use Compress::Raw::Zlib 2.037 qw(Z_OK Z_BUF_ERROR Z_STREAM_END Z_FINISH MAX_WBITS); +use IO::Compress::Base::Common 2.040 qw(:Status); +use Compress::Raw::Zlib 2.040 qw(Z_OK Z_BUF_ERROR Z_STREAM_END Z_FINISH MAX_WBITS); our ($VERSION); -$VERSION = '2.037'; +$VERSION = '2.040'; diff --git a/cpan/IO-Compress/lib/IO/Uncompress/AnyInflate.pm b/cpan/IO-Compress/lib/IO/Uncompress/AnyInflate.pm index 4184f0dca9..20d9c844c4 100644 --- a/cpan/IO-Compress/lib/IO/Uncompress/AnyInflate.pm +++ b/cpan/IO-Compress/lib/IO/Uncompress/AnyInflate.pm @@ -6,22 +6,22 @@ use strict; use warnings; use bytes; -use IO::Compress::Base::Common 2.037 qw(createSelfTiedObject); +use IO::Compress::Base::Common 2.040 qw(createSelfTiedObject); -use IO::Uncompress::Adapter::Inflate 2.037 (); +use IO::Uncompress::Adapter::Inflate 2.040 (); -use IO::Uncompress::Base 2.037 ; -use IO::Uncompress::Gunzip 2.037 ; -use IO::Uncompress::Inflate 2.037 ; -use IO::Uncompress::RawInflate 2.037 ; -use IO::Uncompress::Unzip 2.037 ; +use IO::Uncompress::Base 2.040 ; +use IO::Uncompress::Gunzip 2.040 ; +use IO::Uncompress::Inflate 2.040 ; +use IO::Uncompress::RawInflate 2.040 ; +use IO::Uncompress::Unzip 2.040 ; require Exporter ; our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $AnyInflateError); -$VERSION = '2.037'; +$VERSION = '2.040'; $AnyInflateError = ''; @ISA = qw( Exporter IO::Uncompress::Base ); @@ -48,7 +48,7 @@ sub anyinflate sub getExtraParams { - use IO::Compress::Base::Common 2.037 qw(:Parse); + use IO::Compress::Base::Common 2.040 qw(:Parse); return ( 'RawInflate' => [1, 1, Parse_boolean, 0] ) ; } diff --git a/cpan/IO-Compress/lib/IO/Uncompress/AnyUncompress.pm b/cpan/IO-Compress/lib/IO/Uncompress/AnyUncompress.pm index b7d8bf9330..24343f5a10 100644 --- a/cpan/IO-Compress/lib/IO/Uncompress/AnyUncompress.pm +++ b/cpan/IO-Compress/lib/IO/Uncompress/AnyUncompress.pm @@ -4,16 +4,16 @@ use strict; use warnings; use bytes; -use IO::Compress::Base::Common 2.037 qw(createSelfTiedObject); +use IO::Compress::Base::Common 2.040 qw(createSelfTiedObject); -use IO::Uncompress::Base 2.037 ; +use IO::Uncompress::Base 2.040 ; require Exporter ; our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $AnyUncompressError); -$VERSION = '2.037'; +$VERSION = '2.040'; $AnyUncompressError = ''; @ISA = qw( Exporter IO::Uncompress::Base ); @@ -27,22 +27,22 @@ Exporter::export_ok_tags('all'); BEGIN { - eval ' use IO::Uncompress::Adapter::Inflate 2.037 ;'; - eval ' use IO::Uncompress::Adapter::Bunzip2 2.037 ;'; - eval ' use IO::Uncompress::Adapter::LZO 2.037 ;'; - eval ' use IO::Uncompress::Adapter::Lzf 2.037 ;'; + eval ' use IO::Uncompress::Adapter::Inflate 2.040 ;'; + eval ' use IO::Uncompress::Adapter::Bunzip2 2.040 ;'; + eval ' use IO::Uncompress::Adapter::LZO 2.040 ;'; + eval ' use IO::Uncompress::Adapter::Lzf 2.040 ;'; eval ' use IO::Uncompress::Adapter::UnLzma 2.020 ;'; eval ' use IO::Uncompress::Adapter::UnXz 2.020 ;'; - eval ' use IO::Uncompress::Bunzip2 2.037 ;'; - eval ' use IO::Uncompress::UnLzop 2.037 ;'; - eval ' use IO::Uncompress::Gunzip 2.037 ;'; - eval ' use IO::Uncompress::Inflate 2.037 ;'; - eval ' use IO::Uncompress::RawInflate 2.037 ;'; - eval ' use IO::Uncompress::Unzip 2.037 ;'; - eval ' use IO::Uncompress::UnLzf 2.037 ;'; - eval ' use IO::Uncompress::UnLzma 2.037 ;'; - eval ' use IO::Uncompress::UnXz 2.037 ;'; + eval ' use IO::Uncompress::Bunzip2 2.040 ;'; + eval ' use IO::Uncompress::UnLzop 2.040 ;'; + eval ' use IO::Uncompress::Gunzip 2.040 ;'; + eval ' use IO::Uncompress::Inflate 2.040 ;'; + eval ' use IO::Uncompress::RawInflate 2.040 ;'; + eval ' use IO::Uncompress::Unzip 2.040 ;'; + eval ' use IO::Uncompress::UnLzf 2.040 ;'; + eval ' use IO::Uncompress::UnLzma 2.040 ;'; + eval ' use IO::Uncompress::UnXz 2.040 ;'; } sub new @@ -60,7 +60,7 @@ sub anyuncompress sub getExtraParams { - use IO::Compress::Base::Common 2.037 qw(:Parse); + use IO::Compress::Base::Common 2.040 qw(:Parse); return ( 'RawInflate' => [1, 1, Parse_boolean, 0] , 'UnLzma' => [1, 1, Parse_boolean, 0] ) ; } diff --git a/cpan/IO-Compress/lib/IO/Uncompress/Base.pm b/cpan/IO-Compress/lib/IO/Uncompress/Base.pm index 7d0747796a..7be469fa2c 100644 --- a/cpan/IO-Compress/lib/IO/Uncompress/Base.pm +++ b/cpan/IO-Compress/lib/IO/Uncompress/Base.pm @@ -9,12 +9,12 @@ our (@ISA, $VERSION, @EXPORT_OK, %EXPORT_TAGS); @ISA = qw(Exporter IO::File); -$VERSION = '2.037'; +$VERSION = '2.040'; use constant G_EOF => 0 ; use constant G_ERR => -1 ; -use IO::Compress::Base::Common 2.037 ; +use IO::Compress::Base::Common 2.040 ; use IO::File ; use Symbol; @@ -730,7 +730,7 @@ sub _rd2 while (($status = $z->read($x->{buff})) > 0) { if ($fh) { - print $fh ${ $x->{buff} } + syswrite $fh, ${ $x->{buff} } or return $z->saveErrorString(undef, "Error writing to output file: $!", $!); ${ $x->{buff} } = '' ; } diff --git a/cpan/IO-Compress/lib/IO/Uncompress/Bunzip2.pm b/cpan/IO-Compress/lib/IO/Uncompress/Bunzip2.pm index b08ab47994..0cc72ebbdf 100644 --- a/cpan/IO-Compress/lib/IO/Uncompress/Bunzip2.pm +++ b/cpan/IO-Compress/lib/IO/Uncompress/Bunzip2.pm @@ -4,15 +4,15 @@ use strict ; use warnings; use bytes; -use IO::Compress::Base::Common 2.037 qw(:Status createSelfTiedObject); +use IO::Compress::Base::Common 2.040 qw(:Status createSelfTiedObject); -use IO::Uncompress::Base 2.037 ; -use IO::Uncompress::Adapter::Bunzip2 2.037 ; +use IO::Uncompress::Base 2.040 ; +use IO::Uncompress::Adapter::Bunzip2 2.040 ; require Exporter ; our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $Bunzip2Error); -$VERSION = '2.037'; +$VERSION = '2.040'; $Bunzip2Error = ''; @ISA = qw( Exporter IO::Uncompress::Base ); @@ -40,7 +40,7 @@ sub getExtraParams { my $self = shift ; - use IO::Compress::Base::Common 2.037 qw(:Parse); + use IO::Compress::Base::Common 2.040 qw(:Parse); return ( 'Verbosity' => [1, 1, Parse_boolean, 0], diff --git a/cpan/IO-Compress/lib/IO/Uncompress/Gunzip.pm b/cpan/IO-Compress/lib/IO/Uncompress/Gunzip.pm index e191ee6751..5ce8508e8b 100644 --- a/cpan/IO-Compress/lib/IO/Uncompress/Gunzip.pm +++ b/cpan/IO-Compress/lib/IO/Uncompress/Gunzip.pm @@ -9,12 +9,12 @@ use strict ; use warnings; use bytes; -use IO::Uncompress::RawInflate 2.037 ; +use IO::Uncompress::RawInflate 2.040 ; -use Compress::Raw::Zlib 2.037 qw( crc32 ) ; -use IO::Compress::Base::Common 2.037 qw(:Status createSelfTiedObject); -use IO::Compress::Gzip::Constants 2.037 ; -use IO::Compress::Zlib::Extra 2.037 ; +use Compress::Raw::Zlib 2.040 qw( crc32 ) ; +use IO::Compress::Base::Common 2.040 qw(:Status createSelfTiedObject); +use IO::Compress::Gzip::Constants 2.040 ; +use IO::Compress::Zlib::Extra 2.040 ; require Exporter ; @@ -28,7 +28,7 @@ Exporter::export_ok_tags('all'); $GunzipError = ''; -$VERSION = '2.037'; +$VERSION = '2.040'; sub new { @@ -47,7 +47,7 @@ sub gunzip sub getExtraParams { - use IO::Compress::Base::Common 2.037 qw(:Parse); + use IO::Compress::Base::Common 2.040 qw(:Parse); return ( 'ParseExtra' => [1, 1, Parse_boolean, 0] ) ; } diff --git a/cpan/IO-Compress/lib/IO/Uncompress/Inflate.pm b/cpan/IO-Compress/lib/IO/Uncompress/Inflate.pm index 7435de3d18..6a6ca8ca57 100644 --- a/cpan/IO-Compress/lib/IO/Uncompress/Inflate.pm +++ b/cpan/IO-Compress/lib/IO/Uncompress/Inflate.pm @@ -5,15 +5,15 @@ use strict ; use warnings; use bytes; -use IO::Compress::Base::Common 2.037 qw(:Status createSelfTiedObject); -use IO::Compress::Zlib::Constants 2.037 ; +use IO::Compress::Base::Common 2.040 qw(:Status createSelfTiedObject); +use IO::Compress::Zlib::Constants 2.040 ; -use IO::Uncompress::RawInflate 2.037 ; +use IO::Uncompress::RawInflate 2.040 ; require Exporter ; our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $InflateError); -$VERSION = '2.037'; +$VERSION = '2.040'; $InflateError = ''; @ISA = qw( Exporter IO::Uncompress::RawInflate ); diff --git a/cpan/IO-Compress/lib/IO/Uncompress/RawInflate.pm b/cpan/IO-Compress/lib/IO/Uncompress/RawInflate.pm index f628eef4d3..33cff78572 100644 --- a/cpan/IO-Compress/lib/IO/Uncompress/RawInflate.pm +++ b/cpan/IO-Compress/lib/IO/Uncompress/RawInflate.pm @@ -5,16 +5,16 @@ use strict ; use warnings; use bytes; -use Compress::Raw::Zlib 2.037 ; -use IO::Compress::Base::Common 2.037 qw(:Status createSelfTiedObject); +use Compress::Raw::Zlib 2.040 ; +use IO::Compress::Base::Common 2.040 qw(:Status createSelfTiedObject); -use IO::Uncompress::Base 2.037 ; -use IO::Uncompress::Adapter::Inflate 2.037 ; +use IO::Uncompress::Base 2.040 ; +use IO::Uncompress::Adapter::Inflate 2.040 ; require Exporter ; our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, %DEFLATE_CONSTANTS, $RawInflateError); -$VERSION = '2.037'; +$VERSION = '2.040'; $RawInflateError = ''; @ISA = qw( Exporter IO::Uncompress::Base ); diff --git a/cpan/IO-Compress/lib/IO/Uncompress/Unzip.pm b/cpan/IO-Compress/lib/IO/Uncompress/Unzip.pm index 0ef881328f..054490f91a 100644 --- a/cpan/IO-Compress/lib/IO/Uncompress/Unzip.pm +++ b/cpan/IO-Compress/lib/IO/Uncompress/Unzip.pm @@ -9,14 +9,14 @@ use warnings; use bytes; use IO::File; -use IO::Uncompress::RawInflate 2.037 ; -use IO::Compress::Base::Common 2.037 qw(:Status createSelfTiedObject); -use IO::Uncompress::Adapter::Inflate 2.037 ; -use IO::Uncompress::Adapter::Identity 2.037 ; -use IO::Compress::Zlib::Extra 2.037 ; -use IO::Compress::Zip::Constants 2.037 ; +use IO::Uncompress::RawInflate 2.040 ; +use IO::Compress::Base::Common 2.040 qw(:Status createSelfTiedObject); +use IO::Uncompress::Adapter::Inflate 2.040 ; +use IO::Uncompress::Adapter::Identity 2.040 ; +use IO::Compress::Zlib::Extra 2.040 ; +use IO::Compress::Zip::Constants 2.040 ; -use Compress::Raw::Zlib 2.037 qw(crc32) ; +use Compress::Raw::Zlib 2.040 qw(crc32) ; BEGIN { @@ -31,7 +31,7 @@ require Exporter ; our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $UnzipError, %headerLookup); -$VERSION = '2.037'; +$VERSION = '2.040'; $UnzipError = ''; @ISA = qw(Exporter IO::Uncompress::RawInflate); @@ -64,7 +64,7 @@ sub unzip sub getExtraParams { - use IO::Compress::Base::Common 2.037 qw(:Parse); + use IO::Compress::Base::Common 2.040 qw(:Parse); return ( diff --git a/cpan/IO-Compress/t/000prereq.t b/cpan/IO-Compress/t/000prereq.t index a8e5452131..312ec77558 100644 --- a/cpan/IO-Compress/t/000prereq.t +++ b/cpan/IO-Compress/t/000prereq.t @@ -25,7 +25,7 @@ BEGIN if eval { require Test::NoWarnings ; import Test::NoWarnings; 1 }; - my $VERSION = '2.037'; + my $VERSION = '2.040'; my @NAMES = qw( Compress::Raw::Bzip2 Compress::Raw::Zlib diff --git a/cpan/IO-Compress/t/01misc.t b/cpan/IO-Compress/t/01misc.t index a37aac000c..76d6a7bdc2 100644 --- a/cpan/IO-Compress/t/01misc.t +++ b/cpan/IO-Compress/t/01misc.t @@ -19,7 +19,7 @@ BEGIN { $extra = 1 if eval { require Test::NoWarnings ; import Test::NoWarnings; 1 }; - plan tests => 132 + $extra ; + plan tests => 136 + $extra ; use_ok('Scalar::Util'); use_ok('IO::Compress::Base::Common'); @@ -63,6 +63,10 @@ sub My::testParseParameters() like $@, mkErr("Parameter 'Fred' must be a signed int, got 'abc'"), "wanted signed, got 'abc'"; + eval { ParseParameters(1, {'Fred' => [1, 1, Parse_code, undef]}, Fred => 'abc') ; }; + like $@, mkErr("Parameter 'Fred' must be a code reference, got 'abc'"), + "wanted code, got 'abc'"; + SKIP: { @@ -321,9 +325,17 @@ My::testParseParameters(); $x->subtract($y); is $x->getHigh, 0, " getHigh is 0"; - is $x->getLow, 0xFFFFFFFD, " getLow is 1"; + is $x->getLow, 0xFFFFFFFF, " getLow is 1"; ok ! $x->is64bit(), " ! is64bit"; + $x = new U64(0x01CADCE2, 0x4E815983); + $y = new U64(0x19DB1DE, 0xD53E8000); # NTFS to Unix time delta + + $x->subtract($y); + is $x->getHigh, 0x2D2B03, " getHigh is 2D2B03"; + is $x->getLow, 0x7942D983, " getLow is 7942D983"; + ok $x->is64bit(), " is64bit"; + title "U64 - equal" ; $x = new U64(0, 1); diff --git a/cpan/IO-Compress/t/050interop-gzip.t b/cpan/IO-Compress/t/050interop-gzip.t index 22be0646c8..b9c8da273a 100644 --- a/cpan/IO-Compress/t/050interop-gzip.t +++ b/cpan/IO-Compress/t/050interop-gzip.t @@ -10,6 +10,7 @@ use strict; use warnings; use bytes; +use File::Spec ; use Test::More ; use CompTestUtils; @@ -91,10 +92,13 @@ BEGIN { for my $dir (reverse split $split, $ENV{PATH}) { - $GZIP = "$dir/$name" - if -x "$dir/$name" ; + $GZIP = File::Spec->catfile($dir,$name) + if -x File::Spec->catfile($dir,$name) } + # Handle spaces in path to gzip + $GZIP = "\"$GZIP\"" if $GZIP =~ /\s/; + plan(skip_all => "Cannot find $name") if ! $GZIP ; diff --git a/cpan/IO-Compress/t/105oneshot-zip-only.t b/cpan/IO-Compress/t/105oneshot-zip-only.t index 0da219e416..1f43c2c261 100644 --- a/cpan/IO-Compress/t/105oneshot-zip-only.t +++ b/cpan/IO-Compress/t/105oneshot-zip-only.t @@ -11,6 +11,7 @@ use warnings; use bytes; use Test::More ; +use File::Spec ; use CompTestUtils; BEGIN { @@ -23,13 +24,11 @@ BEGIN { $extra = 1 if eval { require Test::NoWarnings ; import Test::NoWarnings; 1 }; - plan tests => 170 + $extra ; + plan tests => 216 + $extra ; #use_ok('IO::Compress::Zip', qw(zip $ZipError :zip_method)) ; use_ok('IO::Compress::Zip', qw(:all)) ; use_ok('IO::Uncompress::Unzip', qw(unzip $UnzipError)) ; - - } @@ -133,6 +132,35 @@ sub zipGetHeader cmp_ok $hdr->{Time} >> 1, '<=', $after >> 1, " Time is ok"; } +{ + title "Check CanonicalName & FilterName"; + + my $lex = new LexFile my $file1; + + my $content = "hello" ; + writeFile($file1, $content); + my $hdr; + + my $abs = File::Spec->catfile("", "fred", "joe"); + $hdr = zipGetHeader($file1, $content, Name => $abs, CanonicalName => 1) ; + is $hdr->{Name}, "fred/joe", " Name is 'fred/joe'" ; + + $hdr = zipGetHeader($file1, $content, Name => $abs, CanonicalName => 0) ; + is $hdr->{Name}, File::Spec->catfile("", "fred", "joe"), " Name is '/fred/joe'" ; + + $hdr = zipGetHeader($file1, $content, FilterName => sub {$_ = "abcde"}); + is $hdr->{Name}, "abcde", " Name is 'abcde'" ; + + $hdr = zipGetHeader($file1, $content, Name => $abs, + FilterName => sub { s/joe/jim/ }); + is $hdr->{Name}, "fred/jim", " Name is 'fred/jim'" ; + + $hdr = zipGetHeader($file1, $content, Name => $abs, + CanonicalName => 0, + FilterName => sub { s/joe/jim/ }); + is $hdr->{Name}, File::Spec->catfile("", "fred", "jim"), " Name is '/fred/jim'" ; +} + for my $stream (0, 1) { for my $zip64 (0, 1) diff --git a/cpan/IO-Compress/t/compress/oneshot.pl b/cpan/IO-Compress/t/compress/oneshot.pl index 102f221da5..14309ab8c5 100644 --- a/cpan/IO-Compress/t/compress/oneshot.pl +++ b/cpan/IO-Compress/t/compress/oneshot.pl @@ -16,7 +16,7 @@ BEGIN { $extra = 1 if eval { require Test::NoWarnings ; import Test::NoWarnings; 1 }; - plan tests => 986 + $extra ; + plan tests => 989 + $extra ; use_ok('IO::Uncompress::AnyUncompress', qw(anyuncompress $AnyUncompressError)) ; @@ -1578,8 +1578,26 @@ sub run } } -} + { + # check setting $/ + + my $CompFunc = getTopFuncRef($CompressClass); + my $UncompFunc = getTopFuncRef($UncompressClass); + my $lex = new LexFile my $file ; + + local $\ = "\n" ; + my $input = "hello world"; + my $compressed ; + my $output; + ok &$CompFunc(\$input => \$compressed), ' Compressed ok' ; + ok &$UncompFunc(\$compressed => $file), ' UnCompressed ok' ; + my $content = readFile($file) ; + is $content, $input, "round trip ok" ; + + } + +} # TODO add more error cases 1; diff --git a/cpan/IO-Compress/t/cz-14gzopen.t b/cpan/IO-Compress/t/cz-14gzopen.t index 89b04ff1f6..5d0f1fbd08 100644 --- a/cpan/IO-Compress/t/cz-14gzopen.t +++ b/cpan/IO-Compress/t/cz-14gzopen.t @@ -491,7 +491,8 @@ foreach my $stdio ( ['-', '-'], [*STDIN, *STDOUT]) { my $lex = new LexFile my $name ; writeFile($name, "abc"); - chmod 0444, $name ; + chmod 0444, $name + or skip "Cannot create non-writable file", 3 ; skip "Cannot create non-writable file", 3 if -w $name ; diff --git a/pod/perldelta.pod b/pod/perldelta.pod index cf43423ef1..904c6de194 100644 --- a/pod/perldelta.pod +++ b/pod/perldelta.pod @@ -131,6 +131,10 @@ L<Compress::Raw::Zlib> has been upgraded from version 2.037 to version 2.040. =item * +L<Compress::Zlib> has been upgraded from version 2.037 to version 2.040. + +=item * + L<CPANPLUS::Dist::Build> has been upgraded from version 0.58 to version 0.60. =item * |