[ python-Bugs-1336623 ] tarfile can't extract some tar archives..
SourceForge.net
noreply at sourceforge.net
Tue Oct 25 20:36:45 CEST 2005
Bugs item #1336623, was opened at 2005-10-24 17:47
Message generated for change (Comment added) made by meren
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1336623&group_id=5470
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Library
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: A. Murat EREN (meren)
Assigned to: Nobody/Anonymous (nobody)
Summary: tarfile can't extract some tar archives..
Initial Comment:
Here is a small demo to reproduce the same problem:
-----------------8<-----------------8<-----------------8<-----------------8<---
meren at pardus /home/meren $ wget
ftp://ftp.sleepycat.com/releases/db.1.85.tar.gz
(...)
100%[============>] 270,953 17.13K/s ETA 00:00
20:21:09 (15.25 KB/s) - `db.1.85.tar.gz' saved [270,953]
meren at pardus /home/meren $ file db.1.85.tar.gz
db.1.85.tar.gz: gzip compressed data, from Unix
meren at pardus /home/meren $ python
>>> tar = tarfile.open("db.1.85.tar.gz", "r:gz")
>>> for tarinfo in tar:
... print tarinfo.name
...
db.1.85
db.1.85/btree
db.1.85/btree/Makefile.inc
db.1.85/btree/bt_close.c
db.1.85/btree/bt_conv.c
db.1.85/btree/bt_debug.c
db.1.85/btree/bt_delete.c
db.1.85/btree/btree.h
db.1.85/btree/bt_get.c
db.1.85/btree/bt_open.c
(...)
>>> for tarinfo in tar:
... tar.extract(tarinfo)
...
>>> Ctrl + D
meren at pardus /home/meren $ ls db*
db.1.85
db.1.85.tar.gz
meren at pardus /home/meren $ file db.1.85
db.1.85: empty
meren at pardus /home/meren $ cat db.1.85
meren at pardus /home/meren $
----------------->8----------------->8----------------->8----------------->8---
Also this file is extracting with the same result too:
ftp://ftp.linux.org.tr/pub/mirrors/gentoo/distfiles/ncompress-4.2.4.tar.gz
This thing is very rarely happening, but it is
happening. Also, I could extract these archives
properly via the native 'tar' binary..
Thanks in advance,
Ciao.
----------------------------------------------------------------------
>Comment By: A. Murat EREN (meren)
Date: 2005-10-25 18:36
Message:
Logged In: YES
user_id=718263
I figured out that this is a very pesky problem.
The problem is coming from the tar archives themselves.
Simply, the "tarinfo.isdir()" check in the library returns
false for the directories and they are extracting like a
regular file.. How did they create these fool archives I
don't know, and I couldn't reproduce similar buggy archives
by myself. It would be nice to know.
Because of the problem is not in the python library, it is
very difficult to implement an efficent workaround to
properly extract this kind of buggy tar archives. I'm going
to attach a dirty workaround to show the idea (is anyone
reading these reports?)..
Ciao..
----------------------------------------------------------------------
Comment By: A. Murat EREN (meren)
Date: 2005-10-24 18:19
Message:
Logged In: YES
user_id=718263
more examples:
ftp://ftp.porcupine.org/pub/security/portmap_5beta.tar.gz
ftp://ftp.porcupine.org/pub/security/tcp_wrappers_7.6.tar.gz
additionally, the same problem appearing when trying to extract
these archives with the "ark" (yet another kde tool, just a simple
front-end for the tar command. interesting, isn't it).
Ciao.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1336623&group_id=5470
More information about the Python-bugs-list
mailing list