* git-archive loses path info when opened with Winzip?
@ 2008-03-31 11:59 Rogan Dawes
2008-03-31 19:47 ` René Scharfe
0 siblings, 1 reply; 3+ messages in thread
From: Rogan Dawes @ 2008-03-31 11:59 UTC (permalink / raw)
To: Git Mailing List
[-- Attachment #1: Type: text/plain, Size: 1433 bytes --]
Hi folks,
I have noticed something strange with "git-archive"-created tarballs. It
seems that Winzip has trouble parsing the paths for certain files correctly.
The symptom is that Winzip shows some files as having been created at
the "top level" of the zip, without any path at all, while the rest of
the files are within their correct directory structure.
I have attached a screenshot of a gitweb-created snapshot opened in
Winzip 9.0 SR1 (build 6224), but it apparently happens in other (more
recent) versions of Winzip as well.
The tarball in question is at:
<http://dawes.za.net/gitweb.cgi?p=rogan/webscarab/webscarab.git;a=snapshot;h=7ee920dad6b41987f692017dbd9b85259e7a8fe5>
(It's a 2.7MB file). And yes, it happens when git-archive is called
directly, not just via gitweb.cgi.
Regular GNU tar (cygwin) shows the correct path info: (for example)
0 $ tar -tvzf /tmp/webscarab.tar.gz | grep AbstractTreeTableModel
-rw-rw-r-- root/root 2311 2008-03-08 22:35
rogan/webscarab/webscarab.git/src/org/owasp/webscarab/util/swing/treetable/AbstractTreeTableModel.java
0 $
The version of git on the server is:
> [rdawes@lucas rdawes]$ which git
> /home/rdawes/bin/git
> [rdawes@lucas rdawes]$ git --version
> git version 1.5.5.rc1.6.g5cc8f
Any ideas what may be going wrong here? Note that it doesn't seem to
happen when generating a ZIP using git-archive, but only when generating
tarballs.
Regards,
Rogan
[-- Attachment #2: webscarab_winzip.png --]
[-- Type: image/png, Size: 67147 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: git-archive loses path info when opened with Winzip?
2008-03-31 11:59 git-archive loses path info when opened with Winzip? Rogan Dawes
@ 2008-03-31 19:47 ` René Scharfe
2008-03-31 20:09 ` Rogan Dawes
0 siblings, 1 reply; 3+ messages in thread
From: René Scharfe @ 2008-03-31 19:47 UTC (permalink / raw)
To: Rogan Dawes; +Cc: Git Mailing List
Rogan Dawes schrieb:
> Hi folks,
>
> I have noticed something strange with "git-archive"-created tarballs. It
> seems that Winzip has trouble parsing the paths for certain files
> correctly.
>
> The symptom is that Winzip shows some files as having been created at
> the "top level" of the zip, without any path at all, while the rest of
> the files are within their correct directory structure.
>
> I have attached a screenshot of a gitweb-created snapshot opened in
> Winzip 9.0 SR1 (build 6224), but it apparently happens in other (more
> recent) versions of Winzip as well.
Oh, well.
Each file in a tar archive has at least a 512-byte header. This header
contains a name field, 100 bytes long. When it became clear that it
would be nice to support file names longer than 100 characters, another
155 bytes in the header was designated as a prefix field (see tar.h).
The full file name is constructed by concatenating the prefix, a path
separator (/) and the name field -- if a prefix exists. That's how
POSIX defines it, anyway. Apparently WinZip ignores the prefix field.
7-Zip honours the prefix field, by the way. But it doesn't understand
POSIX extended headers; I suspect that WinZip doesn't, too.
That probably makes the easiest way to fix this problem at git's end a
non-starter. Git-archive tries to:
1. fit the path in the name field (up to 100 bytes),
2. in the prefix and name fields (up to 255 bytes),
3. or if even that isn't enough it stores it in an extended header.
Now we could simply make git-archive forget the second option -- but
since support for POSIX extended headers is even more scarce, this
probably won't help.
The second option is to stop encoding long paths using the POSIX method
and start doing it e.g. the GNU way -- or some other tar dialect that is
supported more widely than the official one. NOTE: I haven't checked if
WinZip understands the GNU extensions; it's possible that this problem
can't be solved on git's side at all!
In any case, there are better options:
- Don't use long file names (just kidding :).
- Use a tar extractor that understands the prefix field, e.g. 7-Zip.
- Use zip (but beware of its 65535 bytes name length limit! ;).
- File a bug report with WinZip.
René
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: git-archive loses path info when opened with Winzip?
2008-03-31 19:47 ` René Scharfe
@ 2008-03-31 20:09 ` Rogan Dawes
0 siblings, 0 replies; 3+ messages in thread
From: Rogan Dawes @ 2008-03-31 20:09 UTC (permalink / raw)
To: René Scharfe; +Cc: Git Mailing List
René Scharfe wrote:
> Rogan Dawes schrieb:
>> Hi folks,
>>
>> I have noticed something strange with "git-archive"-created tarballs. It
>> seems that Winzip has trouble parsing the paths for certain files
>> correctly.
>>
>> The symptom is that Winzip shows some files as having been created at
>> the "top level" of the zip, without any path at all, while the rest of
>> the files are within their correct directory structure.
>>
>> I have attached a screenshot of a gitweb-created snapshot opened in
>> Winzip 9.0 SR1 (build 6224), but it apparently happens in other (more
>> recent) versions of Winzip as well.
>
> Oh, well.
>
> Each file in a tar archive has at least a 512-byte header. This header
> contains a name field, 100 bytes long. When it became clear that it
> would be nice to support file names longer than 100 characters, another
> 155 bytes in the header was designated as a prefix field (see tar.h).
[snip]
> In any case, there are better options:
>
> - Don't use long file names (just kidding :).
> - Use a tar extractor that understands the prefix field, e.g. 7-Zip.
> - Use zip (but beware of its 65535 bytes name length limit! ;).
> - File a bug report with WinZip.
>
> René
>
Hi René,
Thanks for the detailed explanation. I guess I should file a bug report
with WinZip, although that won't solve the problem for most of the
population.
My best bet seems to be to provide the option to create Zip files rather
than tarballs (i.e. upgrade my gitweb.cgi to something more recent).
Regards,
Rogan
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-03-31 20:11 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-31 11:59 git-archive loses path info when opened with Winzip? Rogan Dawes
2008-03-31 19:47 ` René Scharfe
2008-03-31 20:09 ` Rogan Dawes
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).