]> granicus.if.org Git - python/commitdiff
Merged revisions 86244 via svnmerge from
authorÉric Araujo <merwok@netwok.org>
Sat, 6 Nov 2010 04:53:42 +0000 (04:53 +0000)
committerÉric Araujo <merwok@netwok.org>
Sat, 6 Nov 2010 04:53:42 +0000 (04:53 +0000)
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r86244 | eric.araujo | 2010-11-06 05:48:05 +0100 (sam., 06 nov. 2010) | 3 lines

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

Lib/distutils/dir_util.py
Misc/NEWS

index 5a968063f7ed4285647315342fd520c3b28a939d..d6875936d62346d9d88b44ca181b5e4e3fac34a3 100644 (file)
@@ -69,10 +69,11 @@ def mkpath(name, mode=0777, verbose=1, dry_run=0):
         if not dry_run:
             try:
                 os.mkdir(head, mode)
-                created_dirs.append(head)
             except OSError, exc:
-                raise DistutilsFileError, \
-                      "could not create '%s': %s" % (head, exc[-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
index 21552c137c5882e3b2347c76ba282048b911c7b8..1948498ccea07a35a50c9ad151a1e67f4256e66c 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -69,6 +69,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