Subject: readline event-hook may hang while waiting on input
Package: libreadline8t64
Source: readline
X-Debbugs-Cc: [email protected]
Version: 8.3-1
Severity: important
Tags: patch

readline 8.3 contains a bug, identified upstream, with the event-hook
leading to complete hang waiting for input.

https://lists.gnu.org/archive/html/bug-readline/2025-07/msg00012.html

upstream patch at :

https://ftp.gnu.org/gnu/readline/readline-8.3-patches/readline83-001

This affects packages such as octave. Reproducible:

* apt install octave
* octave --no-gui
* attempt input.

Tracked in Ubuntu at :
https://bugs.launchpad.net/ubuntu/+source/readline/+bug/2118818

attached is a unified diff version with *somewhat* close to dep3 headers (i
make no promises)
-- 
-----------------------
Dr. John Chittum
Engineering Manager, Canonical, Debcrafters

*************************************


Readline-Release: 8.3
Patch-ID: readline83-001
Bug-Reported-by:      Dmitri A. Sergatskov <[email protected]>
Bug-Reference-ID:      <CAO+XyQ+ipUzFiXvRrDbTstfm1heZrerjvZGVaC60y=
[email protected]>
Description: If an application uses readline's event hook, it is called
while waiting for
  input. There is a bug in the function that waits for available input that
  causes it not to read that input under certain circumstances, resulting in
  a loop where the event hook continues to be called, but there is no input
  to stop it.
From: Chet Ramey <[email protected]>
Origin: https://ftp.gnu.org/gnu/readline/readline-8.3-patches/readline83-001
Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/readline/+bug/2118818
Reviewed-by: John Chittum <[email protected]>

--- a/input.c
+++ b/input.c
@@ -261,13 +261,16 @@
   input = 0;
   tty = fileno (rl_instream);
·
-  /* Move this up here to give it first shot, but it can't set chars_avail
*/
+  /* Move this up here to give it first shot, but it can't set chars_avail,
+     so we assume a single character is available. */
   /* XXX - need rl_chars_available_hook? */
   if (rl_input_available_hook)
     {
       result = (*rl_input_available_hook) ();
       if (result == 0)
         result = -1;
+      else
+        chars_avail = 1;
     }
·
 #if defined (HAVE_PSELECT) || defined (HAVE_SELECT)
@@ -285,6 +288,7 @@
 #endif
       if (result <= 0)
 »······return 0;»······/* Nothing to read. */
+      result = -1;»····/* there is something, so check how many chars
below */
     }
 #endif
·
--- a/patchlevel
+++ b/patchlevel
@@ -1,3 +1,3 @@
 # Do not edit -- exists only for use by patch
·
-0
+1

Reply via email to