Bug#440943: libcompress-zlib-perl: Documentation and/or API inconsistencies

Magnus Holmgren holmgren at lysator.liu.se
Wed Sep 5 16:16:17 UTC 2007

Package: libcompress-zlib-perl
Version: 2.005-3
Severity: important
Tags: upstream


            Closes the compressed file. Any pending data is flushed to
            the file before it is closed.

            Returns 1 on success, 0 on failure.

The actual code:

sub Compress::Zlib::gzFile::gzclose
    my $self = shift ;
    my $gz = $self->[0] ;

    my $status = $gz->close() ;
    return ! $status ;



           $z->close() ;
           close $z ;

       Returns true on success, otherwise 0.

Compress::Zlib::gzFile::gzclose inverts the result from the underlying
call, thus it returns 0 on success, 1 on failure. Contrary to the documentation.

On the other hand, Compress::Zlib::gzFile::gzflush() does indeed
return 1 on success and 0 on failure, which is the opposite of what
versions before 2.0 did, thus potentially breaking many applications.
Neither README nor changelog documents the change.

I haven't checked all subroutines, but gzwrite() and gzread() seem to
work the same.

Magnus Holmgren           holmgren at lysator.liu.se

More information about the pkg-perl-maintainers mailing list