[darcs-users] DeleteFile on Windows

Salvatore Insalaco kirby81 at gmail.com
Wed Oct 28 06:46:53 UTC 2009

Hi Petr,

On Tue, Oct 27, 2009 at 10:12 AM, Petr Rockai <me at mornfall.net> wrote:
> Petr Rockai <me at mornfall.net> writes:
> 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.

This is not really true: you can delete an open file but you cannot
create another file with the same name or delete the parent directory
until all the handles have been closed (FILE_SHARE_DELETE + DeleteFile
behavior is very similar to DELETE_ON_CLOSE).
The problem is that unfortunately this doesn't work with mmapped files.

> 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?

I thought about doing it before Vienna, but unfortunately it seems
harder than I initially thought: there are some cases where we try to
delete the parent directory of a opened mmapped file.
I already did some work that cut the failing tests on Windows by half,
but there's more work to do!

A 100% working Darcs 2.4 on Windows will probably be my Vienna task :).


> Yours,
>   Petr.

More information about the darcs-users mailing list