This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: tarfile: fix for bug #1257255
Type: Stage:
Components: Library (Lib) Versions: Python 2.4
process
Status: closed Resolution: accepted
Dependencies: Superseder:
Assigned To: lars.gustaebel Nosy List: lars.gustaebel, loewis
Priority: normal Keywords: patch

Created on 2005-08-17 12:33 by lars.gustaebel, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
tarfile-name.diff lars.gustaebel, 2005-08-17 12:33 patch to Lib/tarfile.py
tarfile-name-2.diff nobody, 2005-08-25 14:15 updated patch to Lib/tarfile.py
Messages (4)
msg48660 - (view) Author: Lars Gustäbel (lars.gustaebel) * (Python committer) Date: 2005-08-17 12:33
(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.
msg48661 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2005-08-24 06:08
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
msg48662 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2005-08-24 06:49
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.
msg48663 - (view) Author: Lars Gustäbel (lars.gustaebel) * (Python committer) Date: 2006-12-23 18:14
Committed a fix based on tarfile-name-2.diff to rev. 53155 and rev. 53156 (2.5).
History
Date User Action Args
2022-04-11 14:56:12adminsetgithub: 42286
2005-08-17 12:33:14lars.gustaebelcreate