util: do not recurse in makedirs if name is '' (issue2528) stable
authorNicolas Dumazet <nicdumz.commits@gmail.com>
Tue, 30 Nov 2010 17:48:12 +0900
branchstable
changeset 13053 2649be11ab0b
parent 13052 5fb924ee44d5
child 13055 e2b8c7a6ff4d
child 13056 4fdb4b18eb3d
util: do not recurse in makedirs if name is '' (issue2528)
mercurial/util.py
tests/test-bundle.t
--- a/mercurial/util.py	Mon Nov 29 20:13:11 2010 +0100
+++ b/mercurial/util.py	Tue Nov 30 17:48:12 2010 +0900
@@ -841,7 +841,7 @@
     except OSError, err:
         if err.errno == errno.EEXIST:
             return
-        if err.errno != errno.ENOENT:
+        if not name or err.errno != errno.ENOENT:
             raise
     parent = os.path.abspath(os.path.dirname(name))
     makedirs(parent, mode)
--- a/tests/test-bundle.t	Mon Nov 29 20:13:11 2010 +0100
+++ b/tests/test-bundle.t	Tue Nov 30 17:48:12 2010 +0900
@@ -399,6 +399,13 @@
   
   $ rm -r full-clone
 
+When cloning from a non-copiable repository into '', do not
+recurse infinitely (issue 2528)
+
+  $ hg clone full.hg ''
+  abort: No such file or directory
+  [255]
+
 test for http://mercurial.selenic.com/bts/issue216
 
 Unbundle incremental bundles into fresh empty in one go