The test program submitted did not show the bug (which nevertheless exists). So here is a patch for the test program, plus a patch to fix the bug.
--- bzip2test.orig 2008-05-21 23:25:24.000000000 +0200 +++ bzip2test 2008-05-21 23:25:19.000000000 +0200 @@ -36,12 +36,12 @@ print "Error reading from '$file': $!"; close SOURCE; } - last if $bytesread == 0; my $byteswritten = $bz->bzwrite($buffer); if ($byteswritten < $bytesread) { print "Error bzwriting to temporary file: " . $bz->bzerror; close SOURCE; } + last if $bytesread == 0; } my $bzflush = $bz->bzflush(BZ_FINISH);
--- libcompress-bzip2-perl-2.09.orig/Bzip2.xs +++ libcompress-bzip2-perl-2.09/Bzip2.xs @@ -1485,8 +1485,6 @@ return -2; } - if (nUncompressed == 0) return 0; - while (True) { if ( obj->run_progress == 0 ) { ret = BZ2_bzCompressInit ( &(obj->strm), obj->blockSize100k, obj->verbosity, obj->workFactor ); @@ -2253,12 +2251,10 @@ else bufp = SvPV(buf, len); - if (len) { - RETVAL = bzfile_write( obj, bufp, len); + RETVAL = bzfile_write( obj, bufp, len); - if ( RETVAL > 0 ) + if ( RETVAL > 0 ) SvCUR_set( buf, RETVAL ); - } } OUTPUT: --- libcompress-bzip2-perl-2.09.orig/debian/changelog +++ libcompress-bzip2-perl-2.09/debian/changelog @@ -0,0 +1,26 @@ +libcompress-bzip2-perl (2.09-1.2) unstable; urgency=low + + * Non-maintainer upload. + * Fix bug compressing empty files (closes: #464205) + + -- Jeffrey Ratcliffe <[EMAIL PROTECTED]> Wed, 21 May 2008 20:55:33 +0200 + libcompress-bzip2-perl (2.09-1.1) unstable; urgency=low * Non-maintainer upload.