[darcs-users] pure haskell darcs

Juliusz Chroboczek jch at pps.jussieu.fr
Fri Feb 11 14:41:23 UTC 2005


> Is this unsafe?
>
>    exitcode = Cmd.system $ editor ++ ' ':commentfile

Yes, it is if commentfile contains any characters that are special to
the shell.  (Of course, you don't know in general what your shell is
-- it could actually be a Cygwin thing that munges file names in very
mysterious ways.)

> Is the unsafe on windows?
>
>    c:\> cat somefile | ssh me at myhost "cat > remotefile"

Yes, it's potentially unsafe.  It depends on how your shell does
pipes, and how your ssh deals with pipes on standard input.  Of
course, you don't know what your shell is or what your implementation
of ssh is.

>> I guess we'd also lose atomic locks

> Reading through the compat.c code, it looks like you use
> sloppy_atomic_create on windows anyway.

Contrary to what the name implies, sloppy_atomic_create is pretty
careful to create the lock atomically.  There is no way to do that in
portable Haskell98.

(careful_atomic_create is a hack to create a lock atomically even over
NFS.  Darcs is not safe over NFS on legacy operating systems.)

>> and the ability to send email from windows computers

> Not sure of the complexity of the mail sending requirements, but I've
> written SMTP code in pure haskell that works in the simple case.

This assumes you've got access to an SMTP server, which is not a given
under legacy operating systems.

> C is more portable than Haskell.  But Haskell is more portable than
> Haskell AND C.

Haskell and C is more portable than Haskell code that relies on a
shell and an SMTP server.

                                        Juliusz




More information about the darcs-users mailing list