From b21dec0b09ce895979e9236b5c2207440f29d1b4 Mon Sep 17 00:00:00 2001 From: John Sirois Date: Sat, 10 Sep 2022 18:00:26 -0700 Subject: [PATCH] Fail on atomic_directory work_dir collision. (#1905) Previously, in the astronomically unlikely case that two (or more) attempts at creating an atomic directory collided on their UUID4-based work directory, the colliding attempts would all succeed and possibly lead to a corrupt final target directory. Now work directory creation fails loudly when the work directory already exists. Re-try of the Pex command will ~always work in this case but we'll have a paper trail of a UUID4 collision. Fixes #1901 --- pex/common.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pex/common.py b/pex/common.py index 0cf30958a..36a768e11 100644 --- a/pex/common.py +++ b/pex/common.py @@ -466,7 +466,7 @@ def unlock(): return try: - safe_mkdir(atomic_dir.work_dir) + os.makedirs(atomic_dir.work_dir) yield atomic_dir atomic_dir.finalize(source=source) finally: