READLINE PATCH REPORT
                           =====================

Readline-Release: 8.3
Patch-ID: readline83-001

Bug-Reported-by:        Dmitri A. Sergatskov <dasergats...@gmail.com>
Bug-Reference-ID:       
<CAO+XyQ+ipUzFiXvRrDbTstfm1heZrerjvZGVaC60y=txmgy...@mail.gmail.com>
Bug-Reference-URL:      

Bug-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.

Patch (apply with `patch -p0'):

*** ../readline-8.3/input.c     Fri May  2 09:29:05 2025
--- input.c     Tue Jul  8 15:37:13 2025
***************
*** 262,266 ****
    tty = fileno (rl_instream);
  
!   /* Move this up here to give it first shot, but it can't set chars_avail */
    /* XXX - need rl_chars_available_hook? */
    if (rl_input_available_hook)
--- 262,267 ----
    tty = fileno (rl_instream);
  
!   /* 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)
***************
*** 269,272 ****
--- 270,275 ----
        if (result == 0)
          result = -1;
+       else
+         chars_avail = 1;
      }
  
***************
*** 286,289 ****
--- 289,293 ----
        if (result <= 0)
        return 0;       /* Nothing to read. */
+       result = -1;    /* there is something, so check how many chars below */
      }
  #endif
*** ../readline-8.3/patchlevel  2013-11-15 08:11:11.000000000 -0500
--- patchlevel  2014-03-21 08:28:40.000000000 -0400
***************
*** 1,3 ****
  # Do not edit -- exists only for use by patch
  
! 0
--- 1,3 ----
  # Do not edit -- exists only for use by patch
  
! 1

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    c...@case.edu    http://tiswww.cwru.edu/~chet/

Reply via email to