[darcs-users] DeleteFile on Windows

Salvatore Insalaco kirby81 at gmail.com
Sat Oct 10 08:41:30 UTC 2009

On Sat, Oct 10, 2009 at 10:26 AM, Petr Rockai <me at mornfall.net> wrote:
> That'd be great news. So basically, there are two bits we need to address:
> - for _darcs/index, we need to first rename it to a suitable name and then delete
> - we need to memory-map everything with FILE_SHARE_DELETE
> The catch is, that we already do the latter and it doesn't really seem to help?

I had a look at it, and actually (at least one) problem is a little
bit different: there's too much share in mmap:
    handle = CreateFileA(filepath,

The issue is in Storage.Hashed.Index.indexFormatValid:
  fd <- openBinaryFile path ReadMode
  magic <- sequence [ hGetChar fd | _ <- [1..size_magic] :: [Int] ]
  hClose fd

openBinaryFile opens the file in a "posixy" way, and does not use
FILE_SHARE_WRITE: its share request is then more strict than the one
of the "first opener", and the open fails.

I wrote a substitute of openBinaryFile that allows to specify share
flags on Windows: I'm working on it :).


More information about the darcs-users mailing list