Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit dee45e2

Browse files
committed
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.
1 parent cdf6cd9 commit dee45e2

2 files changed

Lines changed: 2 additions & 6 deletions

File tree

Lib/tarfile.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2351,12 +2351,6 @@ def makelink(self, tarinfo, targetpath):
23512351
self._extract_member(self._find_link_target(tarinfo),
23522352
targetpath)
23532353
except symlink_exception:
2354-
if tarinfo.issym():
2355-
linkpath = os.path.join(os.path.dirname(tarinfo.name),
2356-
tarinfo.linkname)
2357-
else:
2358-
linkpath = tarinfo.linkname
2359-
else:
23602354
try:
23612355
self._extract_member(self._find_link_target(tarinfo),
23622356
targetpath)

Misc/NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,8 @@ Core and Builtins
9797
Library
9898
-------
9999

100+
- Issue #12926: Fix a bug in tarfile's link extraction.
101+
100102
- Issue #13696: Fix the 302 Relative URL Redirection problem.
101103

102104
- Issue #13636: Weak ciphers are now disabled by default in the ssl module

0 commit comments

Comments
 (0)