From: Lars Gustäbel Date: Thu, 5 Jan 2012 17:48:06 +0000 (+0100) Subject: Issue #12926: Fix a bug in tarfile's link extraction. X-Git-Tag: v3.2.3rc1~210 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=dee45e20f67f8d81de2d9c003ab18660036d5d73;p=thirdparty%2FPython%2Fcpython.git Issue #12926: Fix a bug in tarfile's link extraction. 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. --- diff --git a/Lib/tarfile.py b/Lib/tarfile.py index 226d4818ca78..af32b0f2cbd9 100644 --- a/Lib/tarfile.py +++ b/Lib/tarfile.py @@ -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) diff --git a/Misc/NEWS b/Misc/NEWS index 08f897f583b3..7adf4f79773b 100644 --- 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