Hi!
In Windows, Darcs has had, and I think, still has weird problems
when deleting or renaming files. I think the reason is that
Darcs uses semi-closed files via readFile.
In Windows, if you do readFile, file is lazily read and closed,
this might mean that it's not evaluated when darcs comes back from
bracket in withXXXX. In unixes files can be unlinked, and are
deleted when last handle is closed. In Windows, files aren't
unlinked, but immediately removed, which doesn't work if there's
an open (or semi-open) handle to the file.
I have made some small tests, and this does seem to happen for
files used for editing comments and descriptions (record and
send), I noticed while making a patch that'd allow usage of
Windows editors that won't stop darcs when file is opened through
system-call. I haven't been able to reproduce those errors with
other situations, but I have seen them.
It'd seem to me that simply replacing readFile with strict version
should be enough. My questions are:
* Do you think this analysis is correct?
* How should this be fixed?
* In Workaround ?
* Is it preferable to use FastPackedString or openFile+hGetChar etc?
(I have tested with hGetChar, and it worked for me)
* Does anyone invent a good way to test this?
Best regards,
--
Esa Ilari Vuokko
|