Prevent race condition with mkdir in distutils. Patch by Arfrever on #9281.

This commit is contained in:
Éric Araujo 2010-11-06 04:48:05 +00:00
parent 909ddbd193
commit ba7209f0a5
2 changed files with 7 additions and 3 deletions

View File

@ -69,10 +69,11 @@ def mkpath(name, mode=0o777, verbose=1, dry_run=0):
if not dry_run:
try:
os.mkdir(head, mode)
created_dirs.append(head)
except OSError as exc:
raise DistutilsFileError(
"could not create '%s': %s" % (head, exc.args[-1]))
if not (exc.errno == errno.EEXIST and os.path.isdir(head)):
raise DistutilsFileError(
"could not create '%s': %s" % (head, exc.args[-1]))
created_dirs.append(head)
_path_created[abs_head] = 1
return created_dirs

View File

@ -65,6 +65,9 @@ Core and Builtins
Library
-------
- Issue #9281: Prevent race condition with mkdir in distutils. Patch by
Arfrever.
- Issue #10229: Fix caching error in gettext.
- Issue #10252: Close file objects in a timely manner in distutils code and