Skip Menu |

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

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

People
Owner: Nobody in particular
Requestors: dam [...] modsoftsys.com
Cc:
AdminCc:

Bug Information
Severity: Critical
Broken in: 2.005
Fixed in: 2.006



Subject: gzreadline() changed behaviour in 2.005 regarding $/
Hi, This was first reported by Peter Baumann in Debian bug #435656. See http://bugs.debian.org/435656 It is all about the Compress::Zlib module. The problem is that in version 1.42, gzreadline() uses "\n" for record separator no mater what $/ is set, but in versions 2.005, gzreadline uses IO::Compress::Base::getline, which does different things depending on $/. The new version breaks programs and modules that depend on the old behaviour of gzreadline. The patch attached restores the old behaviour of Compress::Zlib::gzFile::gzreadline. Please consider applying. <rant> I understand that $/-dependant getline is better overall, but this is why we have IO::Uncompress::* (implemented in IO::Compress::Base) - new modules can introduce new behaviour just fine. Compress::Zlib, however should not change its behaviour, because it would break software that depends on that. </rant> Best regards, dam
Subject: 02_restore-Compress::Zlib::gzFile::gzreadline-record-separator-behaviour.patch
Index: libcompress-zlib-perl/lib/Compress/Zlib.pm =================================================================== --- libcompress-zlib-perl.orig/lib/Compress/Zlib.pm 2007-08-04 07:45:33.000000000 +0300 +++ libcompress-zlib-perl/lib/Compress/Zlib.pm 2007-08-04 07:46:12.000000000 +0300 @@ -180,7 +180,10 @@ my $self = shift ; my $gz = $self->[0] ; - $_[0] = $gz->getline() ; + { + $/ = "\n"; + $_[0] = $gz->getline() ; + } _save_gzerr($gz, 1); return defined $_[0] ? length $_[0] : 0 ; }
From: PMQS [...] cpan.org
Hi Dam, thanks for the report. I mist admit, I was in two minds about adding $/ support to gzreadline when I rewrote Compress::Zlib. Part of the reason I have a very long beta test period for Compress::Zlib version 2 was to shake out issues like this. Obviously nobody noticed, or didn't think to report it back to me. Anyway, you patch isn't quite correct - $/ is a global variable, so a "local" copy needs to be created to limit its scope, like this. { local $/ = "\n"; $_[0] = $gz->getline() ; } This will be included in Compress::Zlib 2.006 cheers Paul
Subject: Re: [rt.cpan.org #28663] gzreadline() changed behaviour in 2.005 regarding $/
Date: Sat, 04 Aug 2007 16:57:22 +0300
To: bug-Compress-Zlib [...] rt.cpan.org
From: Damyan Ivanov <dam [...] modsoftsys.com>
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 - -=| Paul Marquess via RT, 4.08.2007 15:00 |=- Show quoted text
> Anyway, you patch isn't quite correct - $/ is a global variable, so > a "local" copy needs to be created to limit its scope, like this. > > { > local $/ = "\n"; > $_[0] = $gz->getline() ; > }
Hi, Paul, This was exactly what I had in mind. Thank you very much for spotting this. Changing global variable this way would have very unpleasant consequences indeed :) Show quoted text
> This will be included in Compress::Zlib 2.006
Great! - -- dam JabberID: dam@jabber.minus273.org -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFGtIXCHqjlqpcl9jsRAkrDAKCFrNLdPt7q6KQ8tNlT5xYQA7c80QCeOWh6 5vBfbgt7m0H3MdGmnMP4Y1s= =wqqs -----END PGP SIGNATURE-----