[darcs-devel] Moving system code to Haskell

Ian Lynagh igloo at earth.li
Sat Aug 27 14:51:12 PDT 2005


On Fri, Aug 26, 2005 at 06:14:32PM +0200, Juliusz Chroboczek wrote:
>     Sat Jul 30 16:17:03 CEST 2005  Ian Lynagh <igloo at earth.li>
>       * Move atomic_create/sloppy_atomic_create to Compat
> 
>     Sat Jul 30 15:12:05 CEST 2005  Ian Lynagh <igloo at earth.li>
>       * Move maybe_relink out of compat.c
> 
> I believe this to be a mistake.  A very dangerous mistake at that.
> 
> All of this is rather subtle system code, that makes a lot of efforts
> to avoid race conditions.  Because it could be broken by small
> differences in implementation of the primitives it uses, it carefully
> avoids using any library code, but instead uses raw system calls.

You mean POSIX functions, provided by the libc et al libraries, no?

> By moving this code to Haskell, we're becoming dependent on the
> atomicity behaviour of Haskell library calls, which is undocumented
> and might change between releases.  Thus, it is quite likely that the
> change breaks Darcs over NFS, at least in some versions of Ghc.
> 
> An additional concern is that the people who can do correct atomicity
> over exotic file systems are most likely C programmers.  By moving
> this code to Haskell, we make it impossible to people like the NFSv4,
> LUFS or FUSE developers to check our code over their filesystems.
> 
> Ian, I would like to strongly encourage you to revert these changes.

Can you point out specific places where this will cause problems please?
I'd really like to rid darcs of C code completely, so you'll probably
have to show me concrete examples which we can't do in Haskell for some
reason to convince me to go the other way!

While it may not be explicitly written down everywhere, I think we can
assume that we will get the same atomicity guarantees as we would in C.
Ultimately GHC is just going to be calling those same C functions
anyway, unless there is good reason not to.


Thanks
Ian





More information about the darcs-devel mailing list