[Python-checkins] cpython (merge 3.2 -> default): Merge with 3.2: Issue #14160: TarFile.extractfile() failed to resolve symbolic
lars.gustaebel
python-checkins at python.org
Tue Apr 24 21:09:35 CEST 2012
http://hg.python.org/cpython/rev/38df99776901
changeset: 76539:38df99776901
parent: 76537:2023f48b32b6
parent: 76538:0adf4fd8df83
user: Lars Gustäbel <lars at gustaebel.de>
date: Tue Apr 24 21:09:17 2012 +0200
summary:
Merge with 3.2: Issue #14160: TarFile.extractfile() failed to resolve symbolic
links when the links were not located in an archive subdirectory.
files:
Lib/tarfile.py | 2 +-
Lib/test/test_tarfile.py | 3 +++
Lib/test/testtar.tar | Bin
Misc/NEWS | 3 +++
4 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/Lib/tarfile.py b/Lib/tarfile.py
--- a/Lib/tarfile.py
+++ b/Lib/tarfile.py
@@ -2481,7 +2481,7 @@
"""
if tarinfo.issym():
# Always search the entire archive.
- linkname = os.path.dirname(tarinfo.name) + "/" + tarinfo.linkname
+ linkname = "/".join(filter(None, (os.path.dirname(tarinfo.name), tarinfo.linkname)))
limit = None
else:
# Search the archive before the link, because a hard link is
diff --git a/Lib/test/test_tarfile.py b/Lib/test/test_tarfile.py
--- a/Lib/test/test_tarfile.py
+++ b/Lib/test/test_tarfile.py
@@ -171,6 +171,9 @@
def test_fileobj_symlink2(self):
self._test_fileobj_link("./ustar/linktest2/symtype", "ustar/linktest1/regtype")
+ def test_issue14160(self):
+ self._test_fileobj_link("symtype2", "ustar/regtype")
+
class CommonReadTest(ReadTest):
diff --git a/Lib/test/testtar.tar b/Lib/test/testtar.tar
index b93210453d132cf0db07ab26cb50d06f83ee579a..bb9345373e9701b01f16b70844445dfe1863abc6
GIT binary patch
[stripped]
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -71,6 +71,9 @@
Library
-------
+- Issue #14160: TarFile.extractfile() failed to resolve symbolic links when
+ the links were not located in an archive subdirectory.
+
- Issue #14638: pydoc now treats non-string __name__ values as if they
were missing, instead of raising an error.
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list