[darcs-users] darcs patch: resolve issue1131

David Roundy droundy at darcs.net
Wed Oct 8 13:38:47 UTC 2008


On Wed, Oct 08, 2008 at 03:55:36PM +0400, Dmitry Kurochkin wrote:
> Hello!
> 
> I am not able to reproduce the issue. So it is not tested. But it is
> pretty simple so I do not think it introduces any new bugs (and
> hopefully fixes one :)).

It looks pretty good to me.

My only (pretty minor) concern would be with the use of copyFile.
This is not an atomic operation, which means that if its target is a
hash file in _darcs/patches etc, then there will be a possibility of
introducing a hash failure if we (or another darcs) happens to read
that file while it's being written.  I think a better approach would
be to first copyFile to (newname++"-new") and then renameFile to
newname.  But since I think this should go into the release, I won't
make this change myself, since I want to review it... and asking you
to make this change has the effect that someone other than myself must
decide that it's reasonable.

Another possibility (rather than copyFile + renameFile) would be to
create a hard link.  This should be safe for any sort of downloaded
file in darcs.  But this requires a bit more code, and would have to
fall back on copyFile + renameFile if the link-creation fails (as
would happen on windows or if the two target names are on different
filesystems, or on certain filesystem types.

David


More information about the darcs-users mailing list