Skip Menu |

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

Report information
The Basics
Id: 13789
Status: resolved
Priority: 0/
Queue: Compress-Zlib

People
Owner: pmqs [...] cpan.org
Requestors: kmurugan [...] novell.com
nrathna [...] novell.com
Cc:
AdminCc:

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



Subject: Perl Debugger hangs when I am debugging the compress zlib scripts.
STEPS TO DUPLICATE: 1. Copy the attached code snippet to a file =a This test script does below operations, 1. creates a gz file 2. Closes file handle 3. Retries to close the same file handle again =cut use IO::File ; use Compress::Zlib ; my $filename = "rw.gz" ; #create a test file ok(1, my $fil = gzopen($filename, "wb")) ; ok(2, ! $fil->gzclose ) ; ok(3, ! $fil->gzclose ) ; BEGIN{ unlink "rw.gz"; } END{ unlink "rw.gz"; } sub ok { my ($no, $ok) = @_ ; print "ok $no\n" if $ok ; print "not ok $no\n" unless $ok ; } 2. Execute at CLI thru debugger 3. After second call ok(3, ! $fil->gzclose ) ; type p $! in debugger RESULTS: Shell hangs.
Interesting bug -- that has been there for years and nobody noticed. I was about to upload a new version of Compress::Zlib to CPAN anyway, so I sneaked in the fix for this bug while I was at it. Look out for version 1.35 shortly on CPAN. Paul [guest - Wed Jul 20 02:01:59 2005]: Show quoted text
> STEPS TO DUPLICATE: > 1. Copy the attached code snippet to a file > =a > This test script does below operations, > 1. creates a gz file > 2. Closes file handle > 3. Retries to close the same file handle again > =cut > > use IO::File ; > use Compress::Zlib ; > my $filename = "rw.gz" ; > > #create a test file > ok(1, my $fil = gzopen($filename, "wb")) ; > ok(2, ! $fil->gzclose ) ; > ok(3, ! $fil->gzclose ) ; > > BEGIN{ unlink "rw.gz"; } > END{ unlink "rw.gz"; } > > sub ok > { > my ($no, $ok) = @_ ; > print "ok $no\n" if $ok ; > print "not ok $no\n" unless $ok ; > } > > 2. Execute at CLI thru debugger > 3. After second call > ok(3, ! $fil->gzclose ) ; > type p $! in debugger > > RESULTS: > Shell hangs.
Subject: ZLib::Compress 1.34 - $fil->gzclose - returns segfault in the below scenario
Steps: 1. Copy the attached script, which does the below operations a. create a test file and close the same b. open the file and write some compressed string in a loop of 1000 c. try closing the file used in Step a. 2. execute the script at bash. Result: Segfault noticed, when trying to close the already closed file.
use IO::File ; use Compress::Zlib ; my $filename = "rw.zip" ; my $len=length (my $hello = "hello world\nthis is a test\n"); #create a test file my $f = new IO::File ">$filename" ; binmode $f ; print $f $hello; ok(3, my $fil = gzopen($f, "wb")) ; ok(4, $fil->gzwrite($hello) == $len) ; ok(5, ! $fil->gzclose ) ; #Open the file to write the compressed string. $f1 = new IO::File ">>$filename" ; binmode $f1 ; # for OS/2 $i=0; $tempString="String to write\n"; print $f1 compress($tempString),print STDOUT uncompress(compress($tempString)), $i++ while($i++<=1000); ###Segfault occurs in the below line #$fil is already closed in line 12. ok(6, ! $fil->gzclose ) ; sub ok { my ($no, $ok) = @_ ; print "ok $no\n" if $ok ; print "not ok $no\n" unless $ok ; } BEGIN{ unlink "rw.gz"; }
RT-Send-CC: nrathna [...] novell.com
[guest - Thu Jul 28 06:59:56 2005]: Show quoted text
> Steps: > 1. Copy the attached script, which does the below operations > a. create a test file and close the same > b. open the file and write some compressed string in a loop of 1000 > c. try closing the file used in Step a. > > 2. execute the script at bash. > > Result: > Segfault noticed, when trying to close the already closed file.
Thanks for the bug report. This problem was reported in http://rt.cpan.org/Ticket/Display.html?id=13789 and has been fixed in the latest release of Compress::Zlib, version 1.35. Paul