[PATCH v7 0/7] Fix out-of-order keystrokes
Johannes Schindelin
Johannes.Schindelin@gmx.de
Fri Mar 27 16:18:49 GMT 2026
Hi Takashi,
On Fri, 27 Mar 2026, Johannes Schindelin wrote:
> On Wed, 25 Mar 2026, Takashi Yano wrote:
>
> > The reproducer that uses AutoHotKey provided by Johannes:
> > https://cygwin.com/pipermail/cygwin-patches/2026q1/014714.html
> > uncovered several issues regarding input transfer between nat-
> > pipe and cyg-pipe. Most of the issues happen when non-cygwin
> > shell start cygwin-app. This patch series addresses these issues.
> >
> > [...]
>
> Thank you for your hard work, and also: Thank you for figuring out a way
> to drop the Backspace handling via WriteConsoleInputW() I objected to.
>
> I tested this patch series (which required cherry-picking 699c6892f1
> (Cygwin: pty: Fix nat pipe hand-over when pcon is disabled, 2026-03-03)
> and applying
> https://inbox.sourceware.org/cygwin-patches/20260310085139.113-1-takashi.yano@nifty.ne.jp/
> ("Cygwin: pty: Fix input transfer when multiple non-cygwin apps exist")
> before the 7 patches would apply cleanly.
>
> I can confirm that the AutoHotKey-based test now finishes.
>
> However, I have some concerns about the commit messages, and also about
> some coding patterns (such as introducing an expensive `OpenProcess()`
> into a potentially hot code path).
>
> I haven't managed to finish a full review yet, but hope to send out at
> least my finalized feedback for v7 patch 1/7 today, still.
I unexpectedly got some time this afternoon and was able to finish the
review of all 7 patches, with big help of Claude Opus (whenever I had a
"dumb question", it really helped to lean on Opus' quick reading skills).
It's too bad that we cannot "fix this for real", which would be to buffer
the input in a single queue and only deliver it to the consumer on demand,
whether that be a Cygwin or a native process. But there's not really any
way to be notified when a pseudo console's foreground process wants to
consume input. So there is no actual alternative to the current approach:
routing the input preemptively.
For the record, I integrated your v7 patches (with my proposed commit
messages) into https://github.com/git-for-windows/msys2-runtime/pull/124
(which also has an updated AutoHotKey test that now verifies the `cmd.exe`
side of things). The PR build demonstrates the fixes work!
Thank you so much for all your effort to fix these bugs,
Johannes
More information about the Cygwin-patches
mailing list