[Python-checkins] cpython (merge 3.2 -> default): Merge from 3.2: Issue #12926: Fix a bug in tarfile's link extraction.

lars.gustaebel python-checkins at python.org
Thu Jan 5 18:58:59 CET 2012


http://hg.python.org/cpython/rev/5936c2005ab7
changeset:   74278:5936c2005ab7
parent:      74276:7d87ebbbd718
parent:      74277:573fc99873bd
user:        Lars Gustäbel <lars at gustaebel.de>
date:        Thu Jan 05 18:53:00 2012 +0100
summary:
  Merge from 3.2: 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.

files:
  Lib/tarfile.py |  6 ------
  Misc/NEWS      |  2 ++
  2 files changed, 2 insertions(+), 6 deletions(-)


diff --git a/Lib/tarfile.py b/Lib/tarfile.py
--- a/Lib/tarfile.py
+++ b/Lib/tarfile.py
@@ -2340,12 +2340,6 @@
                     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
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -422,6 +422,8 @@
 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

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list