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.py: fix for 1330039
Type: Stage:
Components: Library (Lib) Versions: Python 2.4
process
Status: closed Resolution: accepted
Dependencies: Superseder:
Assigned To: nnorwitz Nosy List: lars.gustaebel, nnorwitz
Priority: normal Keywords: patch

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

Files
File name Uploaded Description Edit
1330039.diff lars.gustaebel, 2005-10-19 12:39 patch to Lib/tarfile.py and Lib/test/test_tarfile.py
Messages (2)
msg48878 - (view) Author: Lars Gustäbel (lars.gustaebel) * (Python committer) Date: 2005-10-19 12:39
The attached patch fixes bug #1330039. The patch
includes a testcase.

A file is added to an archive as a hardlink if a file
with the same inode number (and device number) was
added before without futher checks. This leads to the
undesired behaviour described in #1330039, i.e. if two
throwaway temporary files are assigned the same inode
number by the filesystem, the second one will be added
as a hardlink to the first, which means that the
content will be lost.

The patched code checks if the file's st_nlink is
greater 1. So only for files that actually have several
links pointing to them hardlinks will be created, which
is what GNU tar does.
msg48879 - (view) Author: Neal Norwitz (nnorwitz) * (Python committer) Date: 2005-10-20 04:56
Logged In: YES 
user_id=33168

Thanks Lars.

Checked in as:
 * Lib/tarfile.py 1.34 and 1.21.2.6
 * Lib/test/test_tarfile.py 1.20 and 1.16.2.2
History
Date User Action Args
2022-04-11 14:56:13adminsetgithub: 42501
2005-10-19 12:39:03lars.gustaebelcreate