Subject: | extract() a little confused by a tarball with nothing in it |
I discovered on BackPAN a tarball that is non-empty but has no files nor
directories in it.
http://backpan.perl.org/authors/id/C/CN/CNANDOR/Bundle-Slash-2.12.tar.gz
It is a valid tarball, it just has nothing in it. Archive::Extract is a
little confused by it. Running it through the following:
use Archive::Extract;
my $file = shift;
my $prefer = shift;
$Archive::Extract::PREFER_BIN = $prefer;
$ae = Archive::Extract->new( archive => shift );
$ae->extract( to => "/tmp" ) or die $ae->error;
print $ae->extract_path
With PREFER_BIN true, extract() succeeds, but there is no extract_path().
/var/local/backpan/authors/id/C/CN/CNANDOR/Bundle-Slash-2.11.tar.gz
Use of uninitialized value in print at -e line 1.
With PREFER_BIN false, extract() fails, but there's no reason and
there's an internal warning.
Use of uninitialized value in -d at
/usr/local/lib/perl5/5.10.1/Archive/Extract.pm line 860.
Unable to extract
'/var/local/backpan/authors/id/C/CN/CNANDOR/Bundle-Slash-2.11.tar.gz':
at -e line 1
Use of uninitialized value in print at -e line 1.
Its an open question as to whether extract() should succeed.
Technically, yes it should succeed because its a valid tarball, but it
introduces a weird condition (successful extract() but no
extract_path()) that a user has to check for.