Skip to content

Commit 562f08d

Browse files
authored
gh-143663: Perform path normalization in TarFile.extractall() (GH-143665)
only perform path separator replacement at lstat callsite
1 parent 53f4cad commit 562f08d

2 files changed

Lines changed: 3 additions & 1 deletion

File tree

‎Lib/tarfile.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2554,7 +2554,7 @@ def extractall(self, path=".", members=None, *, numeric_owner=False,
25542554
continue
25552555
dirpath = os.path.join(path, tarinfo.name)
25562556
try:
2557-
lstat = os.lstat(dirpath)
2557+
lstat = os.lstat(dirpath.replace(r'/', os.sep))
25582558
except FileNotFoundError:
25592559
self._log_no_directory_fixup(tarinfo, 'missing')
25602560
continue
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
:meth:`tarfile.TarFile.extractall` now uses OS-specific separators to call
2+
lstat.

0 commit comments

Comments
 (0)