From 5785e338fc8ee1f8f24341250cbb345289d3a43d Mon Sep 17 00:00:00 2001 From: Samantha Hughes Date: Tue, 4 Apr 2023 17:36:02 -0700 Subject: [PATCH 1/3] Update tarfile.py --- Lib/tarfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/tarfile.py b/Lib/tarfile.py index b733195c9c5636..d59452ed4eff8c 100755 --- a/Lib/tarfile.py +++ b/Lib/tarfile.py @@ -2158,7 +2158,7 @@ def _extract_member(self, tarinfo, targetpath, set_attrs=True, if upperdirs and not os.path.exists(upperdirs): # Create directories that are not part of the archive with # default permissions. - os.makedirs(upperdirs) + os.makedirs(upperdirs, exists_ok=True) if tarinfo.islnk() or tarinfo.issym(): self._dbg(1, "%s -> %s" % (tarinfo.name, tarinfo.linkname)) From 7f788fc015fc7ac53e46abf22f1dad0339d5f4b6 Mon Sep 17 00:00:00 2001 From: "blurb-it[bot]" <43283697+blurb-it[bot]@users.noreply.github.com> Date: Wed, 5 Apr 2023 00:48:54 +0000 Subject: [PATCH 2/3] =?UTF-8?q?=F0=9F=93=9C=F0=9F=A4=96=20Added=20by=20blu?= =?UTF-8?q?rb=5Fit.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../2023-04-05-00-48-53.gh-issue-67837.-LJ-2m.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 Misc/NEWS.d/next/Core and Builtins/2023-04-05-00-48-53.gh-issue-67837.-LJ-2m.rst diff --git a/Misc/NEWS.d/next/Core and Builtins/2023-04-05-00-48-53.gh-issue-67837.-LJ-2m.rst b/Misc/NEWS.d/next/Core and Builtins/2023-04-05-00-48-53.gh-issue-67837.-LJ-2m.rst new file mode 100644 index 00000000000000..1e8b7ca040ef52 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2023-04-05-00-48-53.gh-issue-67837.-LJ-2m.rst @@ -0,0 +1 @@ +``tarfile`` - Avoid race condition creating parent directories in when extracting concurrently. From 2af20f265f1f15091f255751c166cd25af5f11e7 Mon Sep 17 00:00:00 2001 From: Samantha Hughes Date: Tue, 4 Apr 2023 18:48:11 -0700 Subject: [PATCH 3/3] Update tarfile.py --- Lib/tarfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/tarfile.py b/Lib/tarfile.py index d59452ed4eff8c..8ad51712770a05 100755 --- a/Lib/tarfile.py +++ b/Lib/tarfile.py @@ -2158,7 +2158,7 @@ def _extract_member(self, tarinfo, targetpath, set_attrs=True, if upperdirs and not os.path.exists(upperdirs): # Create directories that are not part of the archive with # default permissions. - os.makedirs(upperdirs, exists_ok=True) + os.makedirs(upperdirs, exist_ok=True) if tarinfo.islnk() or tarinfo.issym(): self._dbg(1, "%s -> %s" % (tarinfo.name, tarinfo.linkname))