[PATCH 0 of 1] [PATCH] util.rename: use stronger temporary file names

Sune Foldager cryo at cyanite.org
Tue Apr 28 07:03:24 CDT 2009


This patch introduces a lite edition of the deprecated tempfile.mktemp and puts it to use
in util.rename where it is needed to avoid repository corruption on Windows. The current
fix, using a '-force-rename' prefix is not good enough, and is actually worse in some respects
than the previous solution. Worse because once such a file gets stuck, it won't go away by
itself and might corrupt any future strips or other such operations.

I realize that tempfile.mktemp is deprecated for a reason, but I ask you to consider this
carefully; all the reasons and uses given in the explanation for the deprecation do not
apply to our use, and our use is ignored. IMHO it should not have been deprecated since it
has legitimate uses (albeit only on Windows, maybe).

This is not just theoretical; we've had at least three cases of repo corruption due to this,
which have only been saved by our transaction patches which have yet to make it into crew.
Without them each case would have left a corrupt repo.


More information about the Mercurial-devel mailing list