[darcs-users] darcs patch: Re-enable haskeline by default (and 1 more)

Judah Jacobson judah.jacobson at gmail.com
Wed Sep 17 20:29:17 UTC 2008


On Wed, Sep 17, 2008 at 12:14 PM, Gaëtan Lehmann
<gaetan.lehmann at jouy.inra.fr> wrote:
>
> Le 17 sept. 08 à 20:24, Judah Jacobson a écrit :
>>
>> The second attached patch makes darcs/haskeline behave better (i.e.,
>> fail intentionally) in the presence of an EOF or when the user presses
>> ctrl-D.
>
> Thank you again for fixing haskeline, and for haskeline :-)

Gaëtan, thank you for the initiative to include haskeline in darcs in
the first place!

> About ctrl-D, I took care to keep the same behavior than without haskeline
> when I used haskeline in askUser. Are you sure that the code behave better
> with that patch? For sure, darcs behaves differently with or without
> haskeline with that patch.

Without haskeline, we basically just have a call to getLine.  The docs
for hGetLine say it throws an isEOFError if EOF occurs when reading
the first character of the line.  That case is exactly when
haskeline's getInputLine returns Nothing, and thus when my patch
throws an error.

For example, pressing ctrl-D in response to the question "What is the
patch name?" from a 'darcs record' produces

-- (1) with haskeline + with my patch --
What is the patch name?
darcs: askUser: unexpected end of input

-- (2) without haskeline --
What is the patch name? darcs: <stdin>: hGetLine: end of file
[darcs then hangs here, I needed to press ctrl-C to exit...]
withSignalsHandled: Interrupted!

-- (3) with haskeline + without my patch --
What is the patch name?
Do you want to add a long comment? [yn]n
Finished recording patch ''
$ darcs changes --last=1
Wed Sep 17 13:11:03 PDT 2008  judah.jacobson at gmail.com
  * ^D

[That is, it accepted the ctrl-D as a one-character patch name!]


IMO, #3 is incorrect, whereas #1 and #2 are almost the same except for
the content of the error message and an apparent hang in
withSignalsHandled.

I'll try to look into the hang in #2; but I reproduced it in 2.0.2 as
well as an up-to-date repo, so although it seems like a (minor) bug I
don't think it affects the validity of this patch.

-Judah


More information about the darcs-users mailing list