Corruption issue from filesystem exception.

Sune Foldager cryo at cyanite.org
Fri Feb 13 16:32:04 CST 2009


I have come up with a reproduction scenario for this problem.

I made a program which watches all newly created files in a directory  
and opens all of them (with full share modes, like a virus scanner  
likely would) for 1000ms (just to be sure). Since I lack experience in  
Windows C++ as well as Windows non-.NET-apis in general, it's written  
in C#.net. The source code and an executable are available here:

http://cyanite.org/snitch/

In one command window, start the program like this:  filesnitch /path/ 
to/repo/.hg
In another, goto that repo and do a few hg up -r <some rev>. The  
problem should occur pretty often (every 2-3 times on my laptop).

As theorized earlier, the problem occurs with the tmpxxx files; the  
dirstate, .dirstate-xxx, wlock and other files are also kept open, but  
this is not a problem since they are not in the way of a rename. The  
proposed patch, replacing mkstemp with mktemp removes the problem  
since the tmpxxx file is never created (until something is renamed  
into it, but that doesn't matter at that point).

-- 
Sune Foldager



More information about the Mercurial-devel mailing list