[Patches] [ python-Patches-1262036 ] tarfile: fix for bug #1257255

SourceForge.net noreply at sourceforge.net
Sat Dec 23 19:14:52 CET 2006


Patches item #1262036, was opened at 2005-08-17 14:33
Message generated for change (Comment added) made by gustaebel
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1262036&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: Library (Lib)
Group: Python 2.4
>Status: Closed
>Resolution: Accepted
Priority: 5
Private: No
Submitted By: Lars Gustäbel (gustaebel)
Assigned to: Lars Gustäbel (gustaebel)
Summary: tarfile: fix for bug #1257255

Initial Comment:
(See bug #1257255 for a detailed description of the
problem.)
While the problem of the OP is that tarfile won't work
when the current working dir has been removed from the
filesystem, the more important one for me is that the
test in the add() method, that should prevent the
archive from being added to itself, will only succeed
by accident.
So, I decided to save the TarFile's name as an absolute
path from the beginning to ensure that the archive
cannot be added to itself even if the cwd changed
during the operation.


----------------------------------------------------------------------

>Comment By: Lars Gustäbel (gustaebel)
Date: 2006-12-23 19:14

Message:
Logged In: YES 
user_id=642936
Originator: YES

Committed a fix based on tarfile-name-2.diff to rev. 53155 and rev. 53156
(2.5).

----------------------------------------------------------------------

Comment By: Martin v. Löwis (loewis)
Date: 2005-08-24 08:49

Message:
Logged In: YES 
user_id=21627

The patch is actually incorrect. You cannot tar broken
symlinks anymore, as os.path.samefile will raise an OSError
(no such file or directory). Also, os.path.samefile doesn't
exist on Windows.

----------------------------------------------------------------------

Comment By: Martin v. Löwis (loewis)
Date: 2005-08-24 08:08

Message:
Logged In: YES 
user_id=21627

Thanks for the patch. Committed as

tarfile.py 1.30
NEWS 1.1339
tarfile.py 1.21.2.3
NEWS 1.1193.2.75


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1262036&group_id=5470


More information about the Patches mailing list