Skip Menu |

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

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

People
Owner: Nobody in particular
Requestors: sisyphus [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 1.30
Fixed in: (no value)



Subject: Packed relative paths lost on Win32
This may be related to bugs 19577 and/or 18720. Sorry, I don't have a patch. I'm on Windows 2000, running MinGW-built perl 5.8.8 and Archive::Tar-1.30. By way of example, I have a tarball (test.tar.gz) that contains a/b/one.txt and a/b/two.txt. I run the following code: use warnings; use Archive::Tar; my $tar = Archive::Tar->new(); $tar->read('test.tar.gz', 1); $tar->write('test2.tar.gz', 9); I would expect that test.tar.gz and test2.tar.gz would be essentially, if not exactly, the same. On linux this is the case, but not on Win32. On Win32, test2.tar.gz's 'one.txt' and 'two.txt' are unpacked into the top level destination folder - not into destination/a/b. And if I open up test2.tar.gz in WinZip, I can see that nothing is being specified for "Path". Not sure when this first crept in - this breakage exists in both 1.29_01 and 1.30, but not 1.10. Things seem ok after doing the read. The following indicates thata/b/one.txt and a/b/two.txt are found in test.tar.gz: use warnings; use Archive::Tar; my $tar = Archive::Tar->new(); $tar->read('test.tar.gz', 1); if($tar->contains_file('a/b/one.txt') && $tar->contains_file('a/b/two.txt')) {print "OK\n"} But somewhere between then and writing the in-memory archive to file, the paths get lost. Cheers, Rob
On Tue Oct 10 00:11:46 2006, SISYPHUS wrote: Show quoted text
> This may be related to bugs 19577 and/or 18720. Sorry, I don't have a > patch. I'm on Windows 2000, running MinGW-built perl 5.8.8 and > Archive::Tar-1.30. > > By way of example, I have a tarball (test.tar.gz) that contains > a/b/one.txt and a/b/two.txt. > I run the following code: > > use warnings; > use Archive::Tar; > my $tar = Archive::Tar->new(); > $tar->read('test.tar.gz', 1); > $tar->write('test2.tar.gz', 9); > > I would expect that test.tar.gz and test2.tar.gz would be essentially, > if not exactly, the same. On linux this is the case, but not on Win32.
I've attempted to replicate your problem as follows: C:\tmp\src> ls -Rl .: total 16 drwxr-xr-x 3 Administrator None 0 Oct 14 16:16 a ./a: total 0 drwxr-xr-x 2 Administrator None 0 Oct 14 16:16 b ./a/b: total 0 -rw-r--r-- 1 Administrator None 0 Oct 14 16:16 one.txt -rw-r--r-- 1 Administrator None 0 Oct 14 16:16 two.txt C:\tmp\src>
On Tue Oct 10 00:11:46 2006, SISYPHUS wrote: Show quoted text
> This may be related to bugs 19577 and/or 18720. Sorry, I don't have a > patch. I'm on Windows 2000, running MinGW-built perl 5.8.8 and > Archive::Tar-1.30. > > By way of example, I have a tarball (test.tar.gz) that contains > a/b/one.txt and a/b/two.txt. > I run the following code: > > use warnings; > use Archive::Tar; > my $tar = Archive::Tar->new(); > $tar->read('test.tar.gz', 1); > $tar->write('test2.tar.gz', 9); > > I would expect that test.tar.gz and test2.tar.gz would be essentially, > if not exactly, the same. On linux this is the case, but not on Win32.
I've attempted to replicate your problem as follows: C:\tmp\src> ls -Rl .: total 16 drwxr-xr-x 3 Administrator None 0 Oct 14 16:16 a ./a: total 0 drwxr-xr-x 2 Administrator None 0 Oct 14 16:16 b ./a/b: total 0 -rw-r--r-- 1 Administrator None 0 Oct 14 16:16 one.txt -rw-r--r-- 1 Administrator None 0 Oct 14 16:16 two.txt C:\tmp\src>
Sorry for the SPAM, apparently RT was only getting a part of my reply. On Tue Oct 10 00:11:46 2006, SISYPHUS wrote: Show quoted text
> This may be related to bugs 19577 and/or 18720. Sorry, I don't have a > patch. I'm on Windows 2000, running MinGW-built perl 5.8.8 and > Archive::Tar-1.30. > > By way of example, I have a tarball (test.tar.gz) that contains > a/b/one.txt and a/b/two.txt. > I run the following code: > > use warnings; > use Archive::Tar; > my $tar = Archive::Tar->new(); > $tar->read('test.tar.gz', 1); > $tar->write('test2.tar.gz', 9); > > I would expect that test.tar.gz and test2.tar.gz would be essentially, > if not exactly, the same. On linux this is the case, but not on Win32.
I've attempted to replicate your problem as follows: C:\tmp\src> ls -Rl .: total 16 drwxr-xr-x 3 Administrator None 0 Oct 14 16:16 a ./a: total 0 drwxr-xr-x 2 Administrator None 0 Oct 14 16:16 b ./a/b: total 0 -rw-r--r-- 1 Administrator None 0 Oct 14 16:16 one.txt -rw-r--r-- 1 Administrator None 0 Oct 14 16:16 two.txt C:\tmp\srcs shows that in our original tar file, the paths are stored. Using your copy code, i created a test2.tar, which shows exactly the same contents. C:\tmp> cat x.pl use strict; use warnings; use Archive::Tar; my $tar = Archive::Tar->new(); $tar->read( shift() ); $tar->write( shift() ); C:\tmp> perl perl x.pl src\test.tar test2.tar C:\tmp> ptar -tf test2.tar a a/b a/b/one.txt a/b/two.txt So I've been unable to reproduce your problem -- the files are identical, even according to diff(1). I'm using vanilla-perl on Win2003 server, with Archive::Tar 1.30. Show quoted text
> On Win32, test2.tar.gz's 'one.txt' and 'two.txt' are unpacked into the > top level destination folder - not into destination/a/b.
Hmm, also that i can not reproduce: C:\tmp\out> ptar -xf ..\test2.tar C:\tmp\out> ls -Rl .: total 0 drwxr-xr-x 3 Administrator None 0 Oct 14 17:18 a ./a: total 0 drwxr-xr-x 2 Administrator None 0 Oct 14 17:18 b ./a/b: total 0 -rw-r--r-- 1 Administrator None 0 Oct 14 16:16 one.txt -rw-r--r-- 1 Administrator None 0 Oct 14 16:16 two.txt Show quoted text
> And if I open > up test2.tar.gz in WinZip, I can see that nothing is being specified > for "Path".
Hmm, if you are using winzip for the entire process, perhaps this FAQ entry applies to you: I'm using WinZip, or some other non-POSIX client, and files are not being extracted properly! By default, Archive::Tar is in a completely POSIX-compatible mode, which uses the POSIX-specification of tar to store files. For paths greather than 100 characters, this is done using the POSIX header prefix. Non-POSIX-compatible clients may not support this part of the specification, and may only support the GNU Extended Header functionality. To facilitate those clients, you can set the $Archive::Tar::DO_NOT_USE_PREFIX variable to true. See the GLOBAL VARIABLES section for details on this variable. I'm afraid i'm not able to track down the problem for you, as it works as intended on my windows box. Sorry I couldn't be more help :( If you have anything that could help me reproduce the problem, I'm happy to look into it again -- perhaps showing me the tar files (skip the .gz compression) generated by A::T that are faulty would help... Regards, -- Jos
Subject: Re: [rt.cpan.org #21986] Packed relative paths lost on Win32
Date: Sun, 15 Oct 2006 21:28:00 +1000
To: <bug-Archive-Tar [...] rt.cpan.org>
From: "Sisyphus" <sisyphus1 [...] optusnet.com.au>
Show quoted text
----- Original Message ----- From: " via RT" <bug-Archive-Tar@rt.cpan.org>
> > So I've been unable to reproduce your problem -- the files are identical, > even according to diff(1). > I'm using vanilla-perl on Win2003 server, with Archive::Tar 1.30. >
Ok - just to standardise things a little, I'm using Strawberry Perl on Windows 2000, with Archive::Tar-1.30.
> > Hmm, if you are using winzip for the entire process, perhaps this FAQ > entry applies to you: > > I'm using WinZip, or some other non-POSIX client, and files are > not being extracted properly! > > By default, Archive::Tar is in a completely POSIX-compatible mode,
which
> uses the POSIX-specification of tar to store files. For paths greather > than 100 characters, this is done using the POSIX header prefix. > Non-POSIX-compatible clients may not support this part of the
specification,
> and may only support the GNU Extended Header functionality. To
facilitate
> those clients, you can set the $Archive::Tar::DO_NOT_USE_PREFIX
variable
> to true. See the GLOBAL VARIABLES section for details on this
variable.
>
Curiouser and curiouser .... I'm not using *just* WinZip. I find the same problem using gzip.exe and tar.exe from http://gnuwin32.sourceforge.net/packages.html . I see you have 'cat' which doesn't normally exist in the cmd.exe shell ... so I wondered if perhaps there were shell issues at play here. However, I find the same in both the cmd.exe shell and the msys (bash) shell. First up, following on with your suggestion that we stick with uncompressed tar files, here's what 'try.pl' looks like: ---------------------------- E:\pscrpt\archive-tar>type try.pl use warnings; use Archive::Tar; my $tar = Archive::Tar->new(); $tar->read('test.tar', 0); $tar->write('test2.tar', 0); print $Archive::Tar::VERSION, "\n"; ---------------------------- Both 'try.pl' and 'test.tar' are located in E:/pscrpt/archive-tar. (Obviously, test2.tar gets written to the same directory.) For separation purposes, I 'cd' to E:/pscrpt/archive-tar/extract to extract test2.tar. Anyway, here's what I get in the msys shell using the Gnu tar utility with Strawberry Perl: ---------------------------- Rob@DESKTOP /e/pscrpt/archive-tar $ perl try.pl 1.30 Rob@DESKTOP /e/pscrpt/archive-tar $ cd extract Rob@DESKTOP /e/pscrpt/archive-tar/extract $ /d/tar/tar xvf ../test2.tar d:\tar\tar.exe: Blocksize = 8 records a b one.txt two.txt : Permission denied : Permission denied d:\tar\tar.exe: couldn't change access and modification times of b: d:\tar\tar.exe: couldn't change access and modification times of a: Rob@DESKTOP /e/pscrpt/archive-tar/extract ------------------------------------- Which is essentially the same as I get in the cmd.exe shell using the same perl and the same tar utility: ------------------------------------- E:\pscrpt\archive-tar>perl try.pl 1.30 E:\pscrpt\archive-tar>cd extract E:\pscrpt\archive-tar\extract>tar xvf ..\test2.tar tar: Blocksize = 8 records a b one.txt two.txt tar: couldn't change access and modification times of b: : Permission denied tar: couldn't change access and modification times of a: : Permission denied E:\pscrpt\archive-tar\extract> ------------------------------------ Attached is both the original 'test.tar' and the 'test2.tar' that is generated by 'try.pl'. (Is this the right place to send them ? Please let me know if I was supposed to send them elsewhere.) Perhaps both my tar.exe and WinZip.exe programs suffer from the same ailment ? Thank you for replying so promptly. Oops ... I had an afterthought ... what if (in the msys shell) I use that shell's version of 'tar' rather than the Gnu version ? Turns out it makes essentially no difference: ------------------------------------- Rob@DESKTOP /e/pscrpt/archive-tar/extract $ tar xvf ../test2.tar tar: Record size = 8 blocks a b one.txt two.txt ------------------------------------- Finally, as an afterafterthought, I did a 'diff -u': ------------------------------------- E:\pscrpt\archive-tar>diff -u test2.tar test.tar Binary files test2.tar and test.tar differ ------------------------------------- Cheers, Rob
Download test.tar
application/octet-stream 10k

Message body not shown because it is not plain text.

Download test2.tar
application/octet-stream 4k

Message body not shown because it is not plain text.

Subject: Re: [rt.cpan.org #21986] Packed relative paths lost on Win32
Date: Sun, 15 Oct 2006 16:58:28 +0200 (CEST)
To: bug-Archive-Tar [...] rt.cpan.org
From: "Jos Boumans" <kane [...] xs4all.net>
[...] Show quoted text
> I'm not using *just* WinZip. I find the same problem using gzip.exe and > tar.exe from http://gnuwin32.sourceforge.net/packages.html
[...] Ah! I think we may have hit upon the problem here. This GnuTar port is well.. ancient :( They supply only a port of 1.13, which is from 1999 as you can see here: http://ftp.gnu.org/gnu/tar/ At that time, gnu tar didn't have the PREFIX header support yet, so it's blatantly ignoring it in the tar archive created by Archive::Tar. You are indeed getting bitten by the non-POSIX compatibility issue as mentioned in the A::T FAQ. I'll mention expliclity in the FAQ now, that this includes gnu tar pre version 1.14. You could try using the gnu tar supplied by cygwin, who supply 1.15.x. Hopefully this will fix your problem. Good luck, Jos
Subject: Re: [rt.cpan.org #21986] Packed relative paths lost on Win32
Date: Mon, 16 Oct 2006 08:39:35 +1000
To: <bug-Archive-Tar [...] rt.cpan.org>
From: "Sisyphus" <sisyphus1 [...] optusnet.com.au>
Show quoted text
----- Original Message ----- From: "Jos I. Boumans via RT" <bug-Archive-Tar@rt.cpan.org>
> > You could try using the gnu tar supplied by cygwin, who supply 1.15.x. > > Hopefully this will fix your problem. >
Yes, it does fix the problem. Apologies for having thrown a non-Archive::Tar issue at you. Thanks for providing a solution. Cheers, Rob
Subject: Re: [rt.cpan.org #21986] Packed relative paths lost on Win32
Date: Mon, 16 Oct 2006 10:18:57 +1000
To: <bug-Archive-Tar [...] rt.cpan.org>, <SISYPHUS [...] cpan.org>
From: "Sisyphus" <sisyphus1 [...] optusnet.com.au>
Show quoted text
----- Original Message ----- From: "sisyphus1@optusnet.com.au via RT" <bug-Archive-
> Apologies for having thrown a non-Archive::Tar issue at you.
Actually, I was a little hasty there. There's still a problem with Archive::Tar in that when I do: $tar->read('test.tar', 0); $tar->write('test2.tar', 0); then test2.tar is not an exact copy of test.tar. Having created test.tar using cygwin's tar, test2.tar unpacks correctly using that same tar utility. But whilt WinZip unpacks test.tar correctly, it fails to handle test2.tar correctly - again the paths are lost. That can only mean that test.tar and test2.tar are not the same. Does this relate to those other bugs reported re Win32 ? Cheers, Rob
Subject: Re: [rt.cpan.org #21986] Packed relative paths lost on Win32
Date: Mon, 16 Oct 2006 11:21:09 +0200 (CEST)
To: bug-Archive-Tar [...] rt.cpan.org
From: "Jos Boumans" <kane [...] xs4all.net>
Show quoted text
> Actually, I was a little hasty there. There's still a problem with > Archive::Tar in that when I do: > > $tar->read('test.tar', 0); > $tar->write('test2.tar', 0); > > then test2.tar is not an exact copy of test.tar. > > Having created test.tar using cygwin's tar, test2.tar unpacks correctly > using that same tar utility. > > But whilt WinZip unpacks test.tar correctly, it fails to handle test2.tar > correctly - again the paths are lost. > > That can only mean that test.tar and test2.tar are not the same. > > Does this relate to those other bugs reported re Win32 ?
This is still part of the issue i described to you and which is mentioned in the FAQ: WinZIp doesn't understand POSIX compliant tar-achives. test2.tar is indeed not identical to test.tar, as test2.tar is re-packaged using Archive::Tar, and the PREFIX header is used, which WinZip (and your gnu-tar port 1.13) just ignore. hence the problem. Follow the instructions from the FAQ to avoid this behaviour (but realise, your tar archives will now no longer work on strictly POSIX compliant archives) or avoid using non-POSIX compliant extraction applications. Good luck, Jos