Subject: | Archive::Tar strips trailing whitespace from extracted file names |
Date: | Thu, 2 Apr 2015 13:11:41 -0700 |
To: | <bug-archive-tar [...] rt.cpan.org> |
From: | Paul Kolano <paul.kolano [...] nasa.gov> |
Trailing whitespace is stripped from file names during extraction.
To reproduce, create tar containing file with trailing whitespace:
Show quoted text
> mkdir test
> echo foo >test/"space_after "
> tar cvf test.tar test
test/
test/space_after
Program to extract (a.pl):
#!/usr/bin/env perl
use Archive::Tar;
my $tar = Archive::Tar->new;
$tar->read("test.tar");
$tar->extract();
Extract using a.pl:
Show quoted text > a.pl
> mv test test.bak
> a.pl
> diff -r test test.bak
Only in test: space_after
Only in test.bak: space_after
The extracted "space_after " will be created as "space_after".
I believe this can be fixed by changing name from A100 to Z100 in the
Archive::Tar::File unpack string. Haven't tested, but A155 prefix field is
likely also a problem and possibly uname/gname (OSX can have spaces in group
name although not sure if they can be trailing).