Bug#747363: IO::Uncompress::Gunzip: Can no longer gunzip to in-memory file handle

Niko Tyni ntyni at debian.org
Fri May 9 11:08:28 UTC 2014


severity 747363 normal
forwarded 747363 https://rt.cpan.org/Public/Bug/Display.html?id=95494
thanks

On Wed, May 07, 2014 at 10:28:55PM +0200, Christoph Biedl wrote:
> Package: perl-modules
> Version: 5.18.2-2
> Severity: critical
> Justification: Breaks unreleated software

> 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.

Thanks for the report. I've forwarded this upstream as
 https://rt.cpan.org/Public/Bug/Display.html?id=95494

Programs using IO-Compress are not unrelated software, so the 'critical'
severity is unwarranted. I'm lowering the severity.

> -------------------------------------------------------------------
> #!/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;
> -------------------------------------------------------------------

Note that you can uncompress to a scalar reference, which accomplishes
the same thing:

-------------------------------------------------------------------
#!/usr/bin/perl
use IO::Uncompress::Gunzip qw(gunzip $GunzipError);
my $buf_out = '';
gunzip (
    '/usr/share/doc/perl-modules/changelog.Debian.gz',
    \$buf_out
) or die "Failed: $GunzipError, $!";
print $buf_out;
-------------------------------------------------------------------

-- 
Niko Tyni   ntyni at debian.org




More information about the Perl-maintainers mailing list