Subject: | CPAN::Tarzip |
Date: | Sat, 22 Jun 2013 18:30:33 +0100 (BST) |
To: | "bug-CPAN [...] rt.cpan.org" <bug-CPAN [...] rt.cpan.org> |
From: | "Dave Saville" <dave [...] deezee.org> |
There is a problem with Tarzip on non *nix platforms in that in subroutine
gunzip the file handle needs to be set into binary mode. At present it
fails to unzip correctly, producing a tar file that is in error *if* there
were CR/LFs found in the file. It does not seem fixed as of 5.16.0
sub gunzip {
my($self,$write) = @_;
my $read = $self->{FILE};
if ($CPAN::META->has_inst("Compress::Zlib")) {
my($buffer,$fhw);
$fhw = FileHandle->new(">$write")
or $CPAN::Frontend->mydie("Could not open >$write: $!");
my $gz = Compress::Zlib::gzopen($read, "rb")
or $CPAN::Frontend->mydie("Cannot gzopen $read: $!\n");
$fhw->print($buffer)
while $gz->gzread($buffer) > 0 ;
$CPAN::Frontend->mydie("Error reading from $read: $!\n")
if $gz->gzerror != Compress::Zlib::Z_STREAM_END();
$gz->gzclose() ;
$fhw->close;
return 1;
Needs
binmode($fhw);
after the FileHandle->new statement.
--
Kind regards
Dave Saville