Re: [PATCH 3/3] Cygwin: console: Fix typeahead input for bash

Takashi Yano <[email protected]> Wed, 24 Jun 2026 21:33:43 +0900
Newsgroups gmane.os.cygwin.patches
Message-ID <[email protected]>
Hi Mark,

Thansk for reviewing this patch seriese. Pushed.

On Wed, 24 Jun 2026 01:05:16 -0700
Mark Geisert wrote:
> Hi Takashi,
> 
> This patch LGTM.  OK to push.
> 
> ..mark
> 
> On 6/10/2026 9:35 AM, Takashi Yano wrote:
> > Currently, following misbehaviour occurs in bash.
> >    1) Run "sleep 10".
> >    2) Type "cmd<enter>ps<enter>" while "sleep is running".
> >    3) After "sleep" ends, "ps" does not run in "cmd".
> >    4) exit from "cmd". Then, "ps" is executed.
> > This is because process_input_message() handles all the events in
> > the console input buffer, and stores key input into readahead buffer.
> > However, since the readahead buffer is unique to process, "cmd"
> > cannot read it. Since "ps<enter>" is stored in bash's readahead
> > buffer, it is executed by bash after "cmd" exits. With this patch,
> > process_input_message() handles only the requested amount of events
> > by read().
> > 
> > Fixes: 8382778cdb57 ("Cygwin: console: fix select() behaviour")
> > Signed-off-by: Takashi Yano <[email protected]>
> > Reviewed-by:
> > ---
> >   winsup/cygwin/fhandler/console.cc       | 15 ++++++++++++---
> >   winsup/cygwin/local_includes/fhandler.h |  2 +-
> >   winsup/cygwin/select.cc                 |  2 +-
> >   3 files changed, 14 insertions(+), 5 deletions(-)
> [...]


-- 
Takashi Yano <[email protected]>