Fix closes issue10761: tarfile.extractall failure when symlinked files are present.

This commit is contained in:
Senthil Kumaran 2011-04-28 15:30:31 +08:00
parent bdfa2e69e2
commit 011525ee92
3 changed files with 32 additions and 0 deletions

View file

@ -2239,6 +2239,8 @@ class TarFile(object):
if hasattr(os, "symlink") and hasattr(os, "link"):
# For systems that support symbolic and hard links.
if tarinfo.issym():
if os.path.exists(targetpath):
os.unlink(targetpath)
os.symlink(tarinfo.linkname, targetpath)
else:
# See extract().