Bug#539355: perl-modules: Archive::Tar fails to read tar files after a first error

Niko Tyni ntyni at debian.org
Wed Aug 26 20:11:28 UTC 2009


retitle 539355 improve Archive::Tar::error() documentation
severity 539355 minor
thanks

On Fri, Jul 31, 2009 at 02:52:16AM +0200, Vincent Lefevre wrote:
> Package: perl-modules
> Version: 5.10.0-24
> Severity: normal
> 
> Archive::Tar fails to read tar files after a first error.

I believe it doesn't actually fail.

> foreach my $file (@ARGV)
>   {
>     my $tar = Archive::Tar->new;
>     if (defined $tar->read($file))
>       {
>         my $err = $tar->error();
>         warn "$err ($file)\n" if $err ne '';
>       }
>     else
>       {
>         warn "Cannot read tar file $file\n";
>       }
>   }

You aren't testing for any error indicator: the error string only gets
set when read() returns false. The value you're seeing is left over from
the previous read() call. My tests indicate the second file is actually
read successfully and read() returns a positive value.

The fact that error() is an object method but returns a module-wide
(effectively global) value does seem to me like a design oversight and
could at least be documented better. Downgrading the severity, I'll see
about sending a patch upstream.
-- 
Niko Tyni   ntyni at debian.org






More information about the Perl-maintainers mailing list