Skip Menu |

This queue is for tickets about the Compress-Bzip2 CPAN distribution.

Report information
The Basics
Id: 122620
Status: new
Priority: 0/
Queue: Compress-Bzip2

People
Owner: Nobody in particular
Requestors: steve.grazzini [...] grantstreet.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: bzinflate() returns BZ_IO_ERROR
Date: Thu, 27 Jul 2017 20:21:13 +0000
To: bug-Compress-Bzip2 [...] rt.cpan.org
From: Steve Grazzini <steve.grazzini [...] grantstreet.com>
Hello, bzinflate always returns the error BZ_IO_ERROR, which means that none of the example code for the streaming interface actually works. I think that t/060-inflate.t anticipates the actual behavior: while ( my $ln = sysread( $in, $buf, 512 ) ) { # test buf as scalar or scalarref ( $outbuf, $status ) = $d->bzinflate( $counter % 2 ? \$buf : $buf ); # the 2nd attempt to read from the 512 buf in bzfile_streambuf_read will cause a BZ_IO_ERROR if ( $status != BZ_IO_ERROR && $status != BZ_STREAM_END && $status != BZ_OK || !defined($outbuf) ) { diag "error: $outbuf $bzerrno\n"; last; } But I'm not sure that it's correct to do so. Ideally, I think the library should be fixed to suppress that error in this context. But, if that's not practical, the documentation should be fixed to show the necessary checks for BZ_IO_ERROR. For example, the bzcat implementation needs to be: my ($output, $status) ; while (read(STDIN, $input, 4096)) { ($output, $status) = $x->bzinflate(\$input) ; print $output if $status == BZ_OK or $status == BZ_STREAM_END or $status == BZ_IO_ERROR; last if $status != BZ_OK and $status != BZ_IO_ERROR; } die "inflation failed\n" unless $status == BZ_STREAM_END or $status == BZ_IO_ERROR; Thanks!