[Python-checkins] r86244 - in python/branches/py3k: Lib/distutils/dir_util.py Misc/NEWS

eric.araujo python-checkins at python.org
Sat Nov 6 05:48:05 CET 2010


Author: eric.araujo
Date: Sat Nov  6 05:48:05 2010
New Revision: 86244

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



Modified:
   python/branches/py3k/Lib/distutils/dir_util.py
   python/branches/py3k/Misc/NEWS

Modified: python/branches/py3k/Lib/distutils/dir_util.py
==============================================================================
--- python/branches/py3k/Lib/distutils/dir_util.py	(original)
+++ python/branches/py3k/Lib/distutils/dir_util.py	Sat Nov  6 05:48:05 2010
@@ -69,10 +69,11 @@
         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

Modified: python/branches/py3k/Misc/NEWS
==============================================================================
--- python/branches/py3k/Misc/NEWS	(original)
+++ python/branches/py3k/Misc/NEWS	Sat Nov  6 05:48:05 2010
@@ -65,6 +65,9 @@
 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


More information about the Python-checkins mailing list