NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: lib/48957 libedit/readline.c prompt bug
The following reply was made to PR lib/48957; it has been noted by GNATS.
From: "Simon J. Gerraty" <sjg%juniper.net@localhost>
To: <christos%netbsd.org@localhost>, <fgsch%lodoss.net@localhost>, <gnats-bugs%netbsd.org@localhost>,
<sjg%juniper.net@localhost>
Cc:
Subject: Re: lib/48957 libedit/readline.c prompt bug
Date: Thu, 7 Dec 2017 17:49:12 -0800
Simon J. Gerraty <sjg%juniper.net@localhost> wrote:
> If I tweak that to stop doing the
> write "\r \r" dance,
> (which is hiding the extra prompt output)
> we see that the bug is there:
>
> prompt> hi
> prompt> prompt> there
> prompt> prompt> oops
> prompt> prompt>
>
> as I said, I'm not certain what the best fix is, but
> calling el_set(e, EL_UNBUFFERED, 1) here does not appear to be correct.
With the patch below, python works correctly:
Python 2.7.8 (default, Dec 6 2017, 13:52:53)
[GCC 4.2.1 Compatible Juniper Clang 3.7.1
(git%psd-tools-git01.juniper.net@localhost:tool on junos
Type "help", "copyright", "credits" or "license" for more information.
>>> print 'hi'
hi
>>> ^D
and fgsch's test app appears to behave as well as it might (without the
write dance hiding anything) and initializing rl_already_prompted=0
which makes more sense since the app isn't issuing the prompt itself:
prompt> hi
prompt> hi there
prompt> there
prompt> there
prompt>
prompt> one
Index: lib/libedit/readline.c
===================================================================
RCS file: /cvsroot/src/lib/libedit/readline.c,v
retrieving revision 1.144
diff -u -p -r1.144 readline.c
--- lib/libedit/readline.c 17 Sep 2017 08:10:08 -0000 1.144
+++ lib/libedit/readline.c 8 Dec 2017 01:39:24 -0000
@@ -2079,7 +2079,10 @@ rl_callback_read_char(void)
} else
wbuf = NULL;
(*(void (*)(const char *))rl_linefunc)(wbuf);
- el_set(e, EL_UNBUFFERED, 1);
+ if (!rl_already_prompted) {
+ el_set(e, EL_UNBUFFERED, 1);
+ rl_already_prompted = 1;
+ }
}
}
Home |
Main Index |
Thread Index |
Old Index