diff options
author | Senthil Kumaran <senthil@uthcode.com> | 2011-05-17 02:12:18 (GMT) |
---|---|---|
committer | Senthil Kumaran <senthil@uthcode.com> | 2011-05-17 02:12:18 (GMT) |
commit | 4dd89ce6bfb635176d8c9185c148ca11ed207728 (patch) | |
tree | b91a740a816a0da3c8dc0c1942d6b0e2b5299812 /Lib/tarfile.py | |
parent | 72bb99d34351a7636c9ff13e563c9e97e0f1fdac (diff) | |
download | cpython-4dd89ce6bfb635176d8c9185c148ca11ed207728.zip cpython-4dd89ce6bfb635176d8c9185c148ca11ed207728.tar.gz cpython-4dd89ce6bfb635176d8c9185c148ca11ed207728.tar.bz2 |
Fix closes issue #12088 - fixes the tarfile.extractall issue when the
symlinks/hardlink was broken. It handles now in a graceful manner (No exception
is raised, behavior similar GNU tar).
Diffstat (limited to 'Lib/tarfile.py')
-rw-r--r-- | Lib/tarfile.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Lib/tarfile.py b/Lib/tarfile.py index 105a758..6b9303e 100644 --- a/Lib/tarfile.py +++ b/Lib/tarfile.py @@ -2239,12 +2239,14 @@ 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): + if os.path.lexists(targetpath): os.unlink(targetpath) os.symlink(tarinfo.linkname, targetpath) else: # See extract(). if os.path.exists(tarinfo._link_target): + if os.path.lexists(targetpath): + os.unlink(targetpath) os.link(tarinfo._link_target, targetpath) else: self._extract_member(self._find_link_target(tarinfo), targetpath) |