[darcs-users] darcs patch: resolve issue1131

Dmitry Kurochkin dmitry.kurochkin at gmail.com
Wed Oct 8 13:54:25 UTC 2008

On Wed, Oct 8, 2008 at 5:38 PM, David Roundy <droundy at darcs.net> wrote:
> 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.

Sounds reasonable. Patch for copy+rename attached.

I like hard links approach - it should be faster. I will probably
implement it later, but copy+rename should be simple and good enough
for release if Eric decides to push it. I think this should go to some
utility module under name copyFile or safeCopyFile.


> David
> _______________________________________________
> darcs-users mailing list
> darcs-users at darcs.net
> http://lists.osuosl.org/mailman/listinfo/darcs-users
-------------- next part --------------
A non-text attachment was scrubbed...
Name: url-safe-copy.dpatch
Type: application/octet-stream
Size: 44805 bytes
Desc: not available
Url : http://lists.osuosl.org/pipermail/darcs-users/attachments/20081008/acf03875/attachment-0001.obj 

More information about the darcs-users mailing list