util.makedirs: make recursion simpler and more stable (issue2948)
authorMads Kiilerich <mads@kiilerich.com>
Mon, 22 Aug 2011 00:42:38 +0200
changeset 15050 ff3e93686306
parent 15049 79a861b8f553
child 15054 7c03e3b1b858
util.makedirs: make recursion simpler and more stable (issue2948) Before, makedirs could call itself recursively with the same path name it was given, relying on sane file system behavior to terminate the recursion. That could cause infinite recursion on insane file systems. Instead we now call mkdir explicitly after having created parent directory recursively. Exceptions from this mkdir is not swallowed.
mercurial/util.py
--- a/mercurial/util.py	Mon Aug 22 00:35:42 2011 +0200
+++ b/mercurial/util.py	Mon Aug 22 00:42:38 2011 +0200
@@ -789,7 +789,7 @@
         if not name or parent == name or err.errno != errno.ENOENT:
             raise
         makedirs(parent, mode)
-        makedirs(name, mode)
+        os.mkdir(name)
     if mode is not None:
         os.chmod(name, mode)