Skip to content

Commit

Permalink
Fail on atomic_directory work_dir collision. (#1905)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
jsirois authored Sep 11, 2022
1 parent 4e3a9f8 commit b21dec0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pex/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit b21dec0

Please sign in to comment.