Petr Rockai <[email protected]> writes:
> 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?
> The exact C code is this (from cbits/win32.c from the mmap-0.4 package):
>
>     38     handle = CreateFileA(filepath,
>     39                          dwDesiredAccess,
>     40                          
> FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,
>     41                          NULL,
>     42                          dwCreationDisposition,
>     43                          FILE_ATTRIBUTE_NORMAL,
>     44                          NULL);
>
> Maybe I just misunderstand how this is used? Any hints would be appreciated.

(http://irclog.perlgeek.de/darcs/2009-10-27#i_1648320)

>From my reading of MSDN, it seems that you can never use DeleteFile on open
files. However, you can create a new handle using FILE_FLAG_DELETE_ON_CLOSE.

So my plan of action would be to make a removeFile replacement that (as
outlined in the above IRC discussion):
- rename the file to something unique (probably the original filename and an 
unique suffix)
- open it with FILE_FLAG_DELETE_ON_CLOSE
- close the handle again

If the file was open with FILE_SHARE_DELETE previously, this should roughly
work. I haven't tested since it's difficult to work on win32 for me. Salvatore,
do you think this is something you could find time to do at the sprint in
Vienna?

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

Reply via email to