Package: libarchive-tar-perl
Version: 1.23-1

When trying to unpack files from a read archive to
a different location (not from current working dir),
Archive::Tar creates an additional directory named
like the file in the path.
Example:

-------------------------------------------
use Tar;

my $tar = Archive::Tar->new();
$tar->read("knockd.tgz", 1);
foreach $name ($tar->list_files()) {
        my $fullpath = "/tmp/test/" . $name;
        print "fullpath:$fullpath\n";
        $tar->extract_file($name, $fullpath);
        $tar->extract_file($name);
}
-------------------------------------------

the knockd.tgz contains:
drwxr-xr-x root/root         0 2004-10-25 18:38:05 etc/
-rw------- root/root       603 2004-10-25 18:38:05 etc/knockd.conf
drwxr-xr-x root/root         0 2004-10-25 18:38:05 etc/default/
-rw------- root/root       299 2004-10-25 18:38:05 etc/default/knockd

resulting in the following files (after using the code above to unpack):

drwxr-xr-x arne/arne         0 2005-04-21 15:35:46 etc/
drwxr-xr-x arne/arne         0 2005-04-21 15:35:46 etc/knockd.conf/
-rw------- arne/arne       603 2004-10-25 18:38:05 etc/knockd.conf/knockd.conf
drwxr-xr-x arne/arne         0 2005-04-21 15:35:46 etc/default/
drwxr-xr-x arne/arne         0 2005-04-21 15:35:46 etc/default/knockd/
-rw------- arne/arne       299 2004-10-25 18:38:05 etc/default/knockd/knockd

The following patch for Archive::Tar.pm seems to fix this:

--- Tar.pm.old      2005-04-21 15:55:12.000000000 +0200
+++ Tar.pm  2005-04-21 15:53:21.000000000 +0200
@@ -470,8 +470,8 @@

$entry->is_dir );
     my $dir;
     ### is $name an absolute path? ###
-    if( File::Spec->file_name_is_absolute( $name ) ) {
-        $dir = $name;
+    if( File::Spec->file_name_is_absolute( $dirs ) ) {
+        $dir = $dirs;

     ### it's a relative path ###
     } else {

-- 
Arne Bernin <[EMAIL PROTECTED]>



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to