Fix removing of readline callback handler (RHEL-133732)

Resolves: RHEL-133732
This commit is contained in:
Miroslav Lichvar 2026-01-15 16:00:43 +01:00
parent 5ccc1804e8
commit a9572411a2
2 changed files with 39 additions and 0 deletions

37
libedit-rlhandler.patch Normal file
View File

@ -0,0 +1,37 @@
commit 5b29c678702d6e9e8fde48eb9f638dcb4267c212
Author: christos <christos@NetBSD.org>
Date: Sat Aug 21 12:38:56 2021 +0000
PR/56370: mirabilos: libedit change from 2017 kills history in gdb
diff --git a/lib/libedit/readline.c b/lib/libedit/readline.c
index cbae11f5a21..f4219bb3fb3 100644
--- a/src/readline.c
+++ b/src/readline.c
@@ -2078,6 +2078,7 @@ rl_callback_read_char(void)
const char *buf = el_gets(e, &count);
char *wbuf;
+ el_set(e, EL_UNBUFFERED, 1);
if (buf == NULL || count-- <= 0)
return;
if (count == 0 && buf[0] == e->el_tty.t_c[TS_IO][C_EOF])
@@ -2093,7 +2094,6 @@ rl_callback_read_char(void)
} else
wbuf = NULL;
(*(void (*)(const char *))rl_linefunc)(wbuf);
- el_set(e, EL_UNBUFFERED, 1);
}
}
@@ -2111,9 +2111,8 @@ rl_callback_handler_install(const char *prompt, rl_vcpfunc_t *linefunc)
void
rl_callback_handler_remove(void)
{
+ el_set(e, EL_UNBUFFERED, 0);
rl_linefunc = NULL;
- el_end(e);
- e = NULL;
}
void

View File

@ -15,6 +15,8 @@ BuildRequires: ncurses-devel
# Fix reading of $HOME/.editrc and $EDITRC
Patch1: libedit-editrc.patch
# Fix removing of readline callback handler
Patch2: libedit-rlhandler.patch
%description
Libedit is an autotool- and libtoolized port of the NetBSD Editline library.