Subject: | bug in extract, wrong logic in test script |
Running Archive::Tar 0.23 through the CPAN module on Linux (RH 7.2),
with perl 5.8.0 (ithreads, shared libperl), I saw the following
warnings:
splice() offset past end of array at /opt/perl_5.8.0/share/lib/Archive/Tar/Std.pm line 890.
There seems to be some confusion wrt. @_ and @files in the
sub extract.
And the test script seems to have wrong logic concerning use Compress::Zlib
- eval will not tell you if the "use" succeeded or not, you have to
use "$@". And $flag++ && diag(...) will never show the diag - it should
read ++$flag && diag(...).
Here is a patch that solves those two:
diff -ru Archive-Tar-0.23/lib/Archive/Tar/Std.pm Archive-Tar-0.23p/lib/Archive/Tar/Std.pm
--- Archive-Tar-0.23/lib/Archive/Tar/Std.pm 2003-05-20 09:41:41.000000000 +0200
+++ Archive-Tar-0.23p/lib/Archive/Tar/Std.pm 2003-05-20 09:41:58.000000000 +0200
@@ -887,11 +887,11 @@
or goto &_drat
if $handle;
_extract_file ($entry, $handle);
- splice (@_, $cnt, 1);
+ splice (@files, $cnt, 1);
last;
}
last
- unless @_;
+ unless @files;
}
$self;
}
diff -ru Archive-Tar-0.23/t/01_Tar.t Archive-Tar-0.23p/t/01_Tar.t
--- Archive-Tar-0.23/t/01_Tar.t 2003-01-22 00:01:26.000000000 +0100
+++ Archive-Tar-0.23p/t/01_Tar.t 2003-05-20 09:39:52.000000000 +0200
@@ -8,8 +8,11 @@
use_ok( 'Archive::Tar' ) or diag "Archive/Tar.pm not found. Dying", die;
my $flag;
-eval 'use Compress::Zlib'
- or $flag++ && diag "Compress::Zlib not available: will not do compression tests";
+eval 'use Compress::Zlib';
+if($@) {
+ $flag++;
+ diag "Compress::Zlib not available: will not do compression tests";
+}
{
my $tar = Archive::Tar->new;
Cheers,
Marek