[ python-Bugs-1257255 ] tarfile local name is local, should be abspath
SourceForge.net
noreply at sourceforge.net
Thu Aug 25 11:04:14 CEST 2005
Bugs item #1257255, was opened at 2005-08-12 04:26
Message generated for change (Settings changed) made by birkenfeld
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1257255&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: Python 2.4
>Status: Open
>Resolution: None
Priority: 5
Submitted By: Martin Blais (blais)
>Assigned to: Martin v. Löwis (loewis)
Summary: tarfile local name is local, should be abspath
Initial Comment:
I ran into a bug using the tarfile module with
compression from a directory that did not exist
anymore, and this exhibits a bug in the tarfile module.
I'm not completely sure how to fix it with certainty,
so instead of filing a quick patch, I submit a bug so
people familiar with the module can have a look first.
The problem is that when you open a tarfile with gz or
bz2 compression, the TarFile object is opened with a
filename that is not absolute, just local (basename is
called) but the actual file is using a file-like object.
Now, when you add a new entry, there is a check in the
TarFile.add method that checks if we're not adding the
archive itself into the tarfile, and this method calls
abspath. Calling abspath on the name that has been
basename'd is incorrect and a bug. It happens not to
fail nor cause any problems when called from an
existing directory (the test returns false), but it
does not do the job it is supposed to. When the CWD
has been deleted, calling abspath fails with an
OSError, which brings out the problem.
Some code to reproduce the bug is provided in an
attachment.
----------------------------------------------------------------------
>Comment By: Reinhold Birkenfeld (birkenfeld)
Date: 2005-08-25 11:04
Message:
Logged In: YES
user_id=1188172
The patch has been reversed, so reopening.
----------------------------------------------------------------------
Comment By: Martin v. Löwis (loewis)
Date: 2005-08-24 08:08
Message:
Logged In: YES
user_id=21627
This was fixed with said patch.
----------------------------------------------------------------------
Comment By: Lars Gustäbel (gustaebel)
Date: 2005-08-17 14:34
Message:
Logged In: YES
user_id=642936
Thank you very much for your report. I added patch #1262036
that ought to fix the problem.
----------------------------------------------------------------------
Comment By: Martin Blais (blais)
Date: 2005-08-15 19:34
Message:
Logged In: YES
user_id=10996
Oops, that was silly. My apologies. Here goes the file...
----------------------------------------------------------------------
Comment By: Lars Gustäbel (gustaebel)
Date: 2005-08-15 13:39
Message:
Logged In: YES
user_id=642936
Could you please attach the test code you mentioned?
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1257255&group_id=5470
More information about the Python-bugs-list
mailing list