bzr export embeds the tarfile path; causes problems with 7zip

Bug #102234 reported by Martin Pool
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Bazaar
Fix Released
Low
Jelmer Vernooij

Bug Description

Alexader writes:

(Martin, I prefer to continue this discussion in the mailing list,
may be someone already has solution)

Martin Pool пишет:
>> May I ask you to not packing bzr releases in tar.gz with strange tar
>> name.
>> For me it looks like "releases/bzr-0.15.tar" instead of simply
>> "bzr-0.15.tar".
>> Some of Windows archivers (e.g. 7-zip) don't understand such name.
>
>
> I'd be happy to help but I don't know what you mean.
>
> mbp@hope% gzip -l bzr-0.15.tar.gz
> compressed uncompressed ratio uncompressed_name
> 1363733 6932480 80.3% bzr-0.15.tar
>
> mbp@hope% tar tfvz bzr-0.15.tar.gz |head
> -rw-r--r-- user/group 203 2007-04-02 17:01 bzr-0.15/.rsyncexclude
> -rw-r--r-- user/group 150 2007-04-02 17:01 bzr-0.15/BRANCH.TODO
> -rw-r--r-- user/group 17987 2007-04-02 17:01 bzr-0.15/COPYING.txt
> -rw-r--r-- user/group 25666 2007-04-02 17:01 bzr-0.15/HACKING
> -rw-r--r-- user/group 437 2007-04-02 17:01 bzr-0.15/INSTALL
> -rw-r--r-- user/group 3250 2007-04-02 17:01 bzr-0.15/Makefile
> -rw-r--r-- user/group 106952 2007-04-02 17:01 bzr-0.15/NEWS
> -rw-r--r-- user/group 910 2007-04-02 17:01 bzr-0.15/NEWS.developers
>
> Where is the path releases/bzr-0.15?
>
> I made this with a command like
>
> bzr export ../releases/bzr-0.15.tar.gz
>
> so it's possible the path got captured somewhere, which should
> probably be considered a bzr bug.

OK. When I view bzr-0.14.tar.gz and bzr-0.15.tar.gz in binary mode
I see different headers. As I can see in first few bytes there is
name of gzipped tar file.

For bzr-0.14.tar.gz:

0000000000: 1F 8B 08 08 08 6C B5 45 │ 02 FF 62 7A 72 2D 30 2E ▼<◘◘◘lчE☻яbzr-0.
0000000010: 31 34 2E 74 61 72 00 EC │ BD DB 72 1B 59 92 25 DA 14.tar м_Ыr←Y'%Ъ

Bytes from 0x0A to 0x16 is the zero-terminated string 'bzr-0.14.tar'

For bzr-0.15.tar.gz:

0000000000: 1F 8B 08 08 4C AA 10 46 │ 02 FF 2E 2E 2F 72 65 6C ▼<◘◘LЄ►F☻я../rel
0000000010: 65 61 73 65 73 2F 62 7A │ 72 2D 30 2E 31 35 2E 74 eases/bzr-0.15.t
0000000020: 61 72 00 EC BD EB 76 1B │ 59 72 2E E8 BF 9D 4F 91 ar м_лv←Yr.иї_O'

Bytes from 0x0A to 0x22 is the zero-terminating string '../releases/bzr-0.15.tar'

The problem with some of windows archivers. WinRAR handle this well, but others
have some problems. I understand: it's a bug in first place in my archivers
(e.g. 7-zip don't understand such tar.gz at all)
and I will file a bug about such behavior.

But I think if we can, we don't need to generate such name for tar archive,
because such name at least useless and strange.

Do you confirm that this is the bug in 'bzr export'?

Tags: export

Related branches

Revision history for this message
Martin Pool (mbp) wrote :

I think this is a bug, or at least a misbehavior that we can avoid.
Python's tarfile.open has a parameter to set the file name separately
from the file object, and that's probably what goes into the headers.
We should set it to just the basename I think.

Changed in bzr:
importance: Undecided → Low
status: Unconfirmed → Confirmed
Revision history for this message
Alexander Belchenko (bialix) wrote :
Revision history for this message
Martin Pool (mbp) wrote : Re: [BUG?] export to tar.gz produce strange name for inner tar

On 4/6/07, John Arbash Meinel <email address hidden> wrote:
> We could work around this by doing:
>
> fileobj = open(export_path, 'wb')
> tar = tarfile.open(os.path.basename(export_path), 'w:gz',
> fileobj=fileobj)

That's what I had in mind.

--
Martin

Parth Malwankar (parthm)
tags: added: export
Jelmer Vernooij (jelmer)
Changed in bzr:
assignee: nobody → Jelmer Vernooij (jelmer)
status: Confirmed → In Progress
Jelmer Vernooij (jelmer)
Changed in bzr:
milestone: none → 2.4b1
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.