On 10/10/2009 09:41, Salvatore Insalaco wrote:
On Sat, Oct 10, 2009 at 10:26 AM, Petr Rockai<[email protected]>  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,
                          dwDesiredAccess,
                          FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,
                          NULL,
                          dwCreationDisposition,
                          FILE_ATTRIBUTE_NORMAL,
                          NULL);

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

slightly off-topic, but... ew.  At the very least:

   magic <- replicateM size_magic $ hGetChar fd

doesn't HLint say anything about that?

   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 :).

Sounds good. Feel free to make the case (on [email protected]) that FILE_SHARE_DELETE should be the default.

Cheers,
        Simon
_______________________________________________
darcs-users mailing list
[email protected]
http://lists.osuosl.org/mailman/listinfo/darcs-users

Reply via email to