Subject: | contains_file fails to see files in subdirs in gnutar files |
The following test case shows that contains_file() fails unexpectedly for files in a subdirectory. The failure is the "no" in the "perl test.pl" output below. It seems to me that contains_file should simply use _find_entry like the other methods.
% tar --version
tar (GNU tar) 1.13.25
% perl -v
This is perl, v5.8.1 built for darwin
% mkdir Subdir
% echo "test" > Subdir/file
% echo "test" > otherfile
% tar -cf test.tar Subdir otherfile
% perl test.pl
Archive: Subdir/, Subdir/file, otherfile
Contains Subdir/file: no
Content Subdir/file: yes
Contains otherfile: yes
Content otherfile: yes
----------------- test.pl -----------------
use Archive::Tar;
$Archive::Tar::WARN = 0;
my $tar = Archive::Tar->new("test.tar") || die;
print "Archive: ". join(", ", $tar->list_files())."\n";
foreach ("Subdir/file", "otherfile")
{
print "Contains $_: ".($tar->contains_file($_) ? "yes" : "no")."\n";
print "Content $_: ".($tar->get_content($_) ? "yes" : "no")."\n";
}
-------------------------------------------