Skip Menu |

This queue is for tickets about the Archive-Tar CPAN distribution.

Report information
The Basics
Id: 14922
Status: resolved
Priority: 0/
Queue: Archive-Tar

People
Owner: Nobody in particular
Requestors: don.huettl [...] target.com
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 1.26
Fixed in: (no value)



Subject: truncated filenames
There's a bug in Archive::Tar that causes a file like: foo/foo.txt to be stored in the tar file as: foo/.txt I've attached a patch that fixes the problem. Not sure if it's a catch-all solution, but it works for me.
--- Tar.pm.bak 2005-10-04 17:51:31.000000000 -0500 +++ Tar.pm 2005-10-04 17:53:04.000000000 -0500 @@ -763,7 +763,7 @@ ### remove the prefix from the file name ### ### not sure if this is still neeeded --kane ### if( length $prefix ) { - $file =~ s/^$match//; + $file =~ s|^$match/||; } $prefix = File::Spec::Unix->catdir($ext_prefix, $prefix) if length $ext_prefix;
On Tue Oct 04 19:15:59 2005, guest wrote: Show quoted text
> There's a bug in Archive::Tar that causes a file like: > > foo/foo.txt > > to be stored in the tar file as: > > foo/.txt
I've tried to reproduce the problem with 1.26, but i've not been able to... Show quoted text
> I've attached a patch that fixes the problem. Not sure if it's a > catch-all solution, but it works for me.
The patch seems to have been garbled -- its' not plain asci, and looks something like this to me: I have applied the following patch, to make sure this issue will not surface (again) and go uncaught: ==== //member/kane/archive-tar-new/t/04_resolved_issues.t#3 - /Users/kane/sources/ p4/other/archive-tar-new/t/04_resolved_issues.t ==== 59a60,99 Show quoted text
> > ### bug #14922 > ### There's a bug in Archive::Tar that causes a file like: foo/foo.txt > ### to be stored in the tar file as: foo/.txt > ### XXX could not be reproduced in 1.26 -- leave test to be sure > { my $dir = $$ . '/'; > my $file = $$ . '.txt'; > my $out = $$ . '.tar'; > > ### first create the file > { my $tar = $Class->new; > > isa_ok( $tar, $Class ); > ok( $tar->add_data( $dir.$file => $$ ), > " Added long file" ); > > ok( $tar->write($out), " File written to $out" ); > } > > ### then read it back in > { my $tar = $Class->new; > isa_ok( $tar, $Class ); > ok( $tar->read( $out ), " Read in $out again" ); > > my @files = $tar->get_files; > is( scalar(@files), 1, " Only 1 entry found" ); > > my $entry = shift @files; > ok( $entry->is_file, " Entry is a file" ); > is( $entry->full_path, $dir.$file, > " With the proper name" ); > } > > ### remove the file > unless( $NO_UNLINK ) { 1 while unlink $out } > } > > > >
On Tue Oct 04 19:15:59 2005, guest wrote: Show quoted text
> There's a bug in Archive::Tar that causes a file like: > > foo/foo.txt > > to be stored in the tar file as: > > foo/.txt > > I've attached a patch that fixes the problem. Not sure if it's a > catch-all solution, but it works for me.
Actually, i've found why it's not breaking anymore -- the code has been fixed ;) Here's the relevant comment for that section: ### remove the prefix from the file name ### not sure if this is still neeeded --kane ### no it's not -- Archive::Tar::File->_new_from_file will take care of ### this for us. Even worse, this would break if we tried to add a file ### like x/x. #if( length $prefix ) { # $file =~ s/^$match//; #}