aboutsummaryrefslogtreecommitdiff
path: root/readline
diff options
context:
space:
mode:
authorAndrew Burgess <aburgess@redhat.com>2022-04-26 15:08:02 +0100
committerAndrew Burgess <aburgess@redhat.com>2022-05-07 10:49:27 +0100
commit8f3babfaf8ea582bed93fd6abcde7bfc96d3a8dd (patch)
tree6a1f0a3e54a3d276ad9c425a8a40a4193696bc6a /readline
parent69464d2267c47e91f9ba77726c745d82b8864c88 (diff)
downloadgdb-8f3babfaf8ea582bed93fd6abcde7bfc96d3a8dd.zip
gdb-8f3babfaf8ea582bed93fd6abcde7bfc96d3a8dd.tar.gz
gdb-8f3babfaf8ea582bed93fd6abcde7bfc96d3a8dd.tar.bz2
gdb/readline: fix extra 'quit' message problem
After these two commits: commit 4fb7bc4b147fd30b781ea2dad533956d0362295a Date: Mon Mar 7 13:49:21 2022 +0000 readline: back-port changes needed to properly detect EOF commit 91395d97d905c31ac38513e4aaedecb3b25e818f Date: Tue Feb 15 17:28:03 2022 +0000 gdb: handle bracketed-paste-mode and EOF correctly It was observed that, if a previous command is selected at the readline prompt using the up arrow key, then when the command is accepted (by pressing return) an unexpected 'quit' message will be printed by GDB. Here's an example session: (gdb) p 123 $1 = 123 (gdb) p 123 quit $2 = 123 (gdb) In this session the second 'p 123' was entered not by typing 'p 123', but by pressing the up arrow key to select the previous command. It is important that the up arrow key is used, typing Ctrl-p will not trigger the bug. The problem here appears to be readline's EOF detection when handling multi-character input sequences. I have raised this issue on the readline mailing list here: https://lists.gnu.org/archive/html/bug-readline/2022-04/msg00012.html a solution has been proposed here: https://lists.gnu.org/archive/html/bug-readline/2022-04/msg00016.html This patch includes a test for this issue as well as a back-port of (the important bits of) readline commit: commit 2ef9cec8c48ab1ae3a16b1874a49bd1f58eaaca1 Date: Wed May 4 11:18:04 2022 -0400 fix for setting RL_STATE_EOF in callback mode That commit also includes some updates to the readline documentation and tests that I have not included in this commit. With this commit in place the unexpected 'quit' messages are resolved.
Diffstat (limited to 'readline')
-rw-r--r--readline/readline/callback.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/readline/readline/callback.c b/readline/readline/callback.c
index 58b84d2..93f23d9 100644
--- a/readline/readline/callback.c
+++ b/readline/readline/callback.c
@@ -271,8 +271,11 @@ rl_callback_read_char (void)
}
/* Make sure application hooks can see whether we saw EOF. */
- if (rl_eof_found = eof)
- RL_SETSTATE(RL_STATE_EOF);
+ if (eof > 0)
+ {
+ rl_eof_found = eof;
+ RL_SETSTATE(RL_STATE_EOF);
+ }
if (rl_done)
{