Subject: | IO::Uncompress::Gunzip: Can no longer gunzip to in-memory file handle |
Forwarding report from Christoph Biedl in <http://bugs.debian.org/747363>. This appears to have broken between 2.037 and 2.040.
I see the output parameter can be a scalar reference, so supporting output to in-memory file handles seems like duplicated functionality.
Cristoph's reproducer script is attached.
-----
IO-Compress 2.060 as bundled with Perl 5.18.2 introduces a regression over 2.033 (as in Debian wheezy) and older versions like 2.020 in squeeze: When uncompressing to a filehandle that is connected to an in-memory string with
open $fh, '>', \$buf
the syswrite() in IO::Uncompress::Base::_rd2 (line 759) fails with $! set to "Bad file descriptor". In previous versions, print was used instead which did not have this problem.
The problem is not limited to gunzip decompression. FWIW, *gzip* to such a handle still works, also gzip and gunzip *from* a in-memory handle.
------
Subject: | i.pl |
#!/usr/bin/perl
use IO::Uncompress::Gunzip qw(gunzip $GunzipError);
my $buf_out = '';
open my $fh_out, '>', \$buf_out or die $!;
gunzip (
'/usr/share/doc/perl-modules/changelog.Debian.gz',
$fh_out
) or die "Failed: $GunzipError, $!";
print $buf_out;