[darcs-users] Re: darcs - Problem with MacOS X HFS+ File System

David Roundy droundy at abridgegame.org
Sat Mar 5 14:20:36 UTC 2005

On Fri, Mar 04, 2005 at 03:32:03PM +0100, Markus Hanauska wrote:
> It's not renameFile. I compiled a darcs version where it is done like 
> in Windows and it still does not work. I once made sure the renameFile 
> test in the autoconfig script failed and once the like-test failed 
> (that one fails in Windows, too, Windows don't know the concept of 
> links at all) and both did not work. I can try to have both failing at 
> once if you see any chance that this might help.

Okay, I've also verified this, and the fix doesn't work.  So what's causing
the trouble?

I see it! It's the careful_atomic_create in compat.c, which really is only
needed for lock-grabbing, but we use anyways when we create a file.  This
function does some hard-link trickery to ensure that even over NFS two
darcs instances can't accidentally both grab _darcs/lock.

If you run with the environment variable DARCS_SLOPPY_LOCKS=1, there's no
problem (at least in my simple tests involving xcode)! :) If only Juliusz
were a mac person, I bet he would have been reading this and would have
thought of this ages ago.  (It seems like he's always telling people to try
running with DARCS_SLOPPY_LOCKS... he wrote the locking code.)

I think the best solution is to introduce a takeSloppyLock (perhaps called
something like withNewFile or something) in Lock.lhs, which we can use when
we don't want real locking.  It'll probably be a tad faster, and will avoid
the complicated lock code when we don't actually want locking behavior.

The other alternative that comes to mind would be to avoid the careful
locking code entirely on the mac.  That seems to me like a worse solution.

In the meantime, you can just define DARCS_SLOPPY_LOCKS in your .bashrc (or
whatever) which should fix the problem.
David Roundy

More information about the darcs-users mailing list