]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Issue #12926: Fix a bug in tarfile's link extraction.
authorLars Gustäbel <lars@gustaebel.de>
Thu, 5 Jan 2012 17:48:06 +0000 (18:48 +0100)
committerLars Gustäbel <lars@gustaebel.de>
Thu, 5 Jan 2012 17:48:06 +0000 (18:48 +0100)
On platforms that do not support (symbolic) links, tarfile offers a
work-around and extracts a link in an archive as the regular file the link is
pointing to. On other platforms, this code was accidentally executed even
after the link had been successfully extracted which failed due to the already
existing link.

Lib/tarfile.py
Misc/NEWS

index 226d4818ca78359cedab6dbdf5b7ef489d74f539..af32b0f2cbd9d3d65345bc7d0f97460768400718 100644 (file)
@@ -2351,12 +2351,6 @@ class TarFile(object):
                     self._extract_member(self._find_link_target(tarinfo),
                                          targetpath)
         except symlink_exception:
-            if tarinfo.issym():
-                linkpath = os.path.join(os.path.dirname(tarinfo.name),
-                                        tarinfo.linkname)
-            else:
-                linkpath = tarinfo.linkname
-        else:
             try:
                 self._extract_member(self._find_link_target(tarinfo),
                                      targetpath)
index 08f897f583b3f56bcc989d427c0604c47d8ed9f2..7adf4f79773b7f29a90b25e0606c86a71dc24ab4 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -97,6 +97,8 @@ Core and Builtins
 Library
 -------
 
+- Issue #12926: Fix a bug in tarfile's link extraction.
+
 - Issue #13696: Fix the 302 Relative URL Redirection problem.
 
 - Issue #13636: Weak ciphers are now disabled by default in the ssl module