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

Markus Hanauska hanauska at equinux.net
Fri Mar 4 14:32:03 UTC 2005

On 03. Mrz 2005, at 14:26 Uhr, David Roundy wrote:

> Okay, I think I may have an idea what's happening here, although I 
> haven't
> verified it.  In order to atomically modify files, darcs uses the 
> haskell
> (standard library) function "renameFile", which is supposed to 
> atomically
> overwrite the target file, if it already exists (so that in case of
> crash/power outage it is guaranteed that either the old or the new 
> version
> of that file exists).
> On windows, we can't do this, as there isn't an atomic rename 
> operation, so
> we just need to hope for the best.  My guess is that the ghc 
> implementation
> perhaps implements renameFile "a" "b" as something equivalent to
> ln a b
> rm a
> which according to your tests would render the file b unopenable by 
> xcode.
> (And also is guaranteed to work on any POSIX filesystem, so it's not
> unreasonable on a system that claims to be POSIX.)
> This ought to be straightforward to work around--we already have an
> autoconf test that checks whether renameFile fails if the target file
> already exists (for windows) and uses an alternate version if that is 
> the
> case.  We just need to figure out whether we're running on MacOS, and 
> if
> that is the case use an alternate method--perhaps the same as we do in
> windows, just delete the target file first and hope the power doesn't 
> go
> out.
> It also would be good (if this analysis is correct) to point this out 
> to
> the ghc folks, so they could fix their implementation of renameFile.

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.

Best Regards,
     Markus Hanauska

More information about the darcs-users mailing list