[darcs-devel] [issue822] improve 'host not found' error message

Ernesto bugs at darcs.net
Tue Dec 9 15:28:17 UTC 2014


Ernesto <neto at netowork.me> added the comment:

I took a look at this issue. There are a number of things to consider:

1) scp returns a -1 exit code when host is not found. Since -1 is
returned for general failures, the only way to know what really happened
is inspecting the output.

2) In the file Darcs/Repository/Format.hs:113, all a catchall exception
guard is used and the result is set to an empty Bytestring if failed.
Then a generic error message is given.

To solve (1) we either use an ssh library for Haskell or we read the
output of the ssh command. If you don't mind the extra dependency,
http://hackage.haskell.org/package/knob, seems worth trying to dump the
output directly to memory. Otherwise a temporary file handle has to be used.
To solve (2) We can throw an ExecException with the error message from
scp on failure and catch that exception in Format.hs for a better
message. Or change the function fetchFilePS to return an either type
which is a more Haskell way of doing it.

I am happy to work on this issue by reading the output from ssh and
changing the type of fetchFilePS but since I have not contributed to
Darcs, would like to know if my approach is reasonable.

__________________________________
Darcs bug tracker <bugs at darcs.net>
<http://bugs.darcs.net/issue822>
__________________________________


More information about the darcs-devel mailing list