Typed characters are mis-ordered when CPU usage is high

Orgad Shaneh orgads@gmail.com
Fri Mar 18 05:57:27 GMT 2022


On Fri, Mar 18, 2022 at 7:22 AM Takashi Yano <takashi.yano@nifty.ne.jp> wrote:
>
> On Fri, 18 Mar 2022 13:23:35 +0900
> Takashi Yano <takashi.yano@nifty.ne.jp> wrote:
>
> > On Thu, 17 Mar 2022 20:40:15 +0200
> > Orgad Shaneh wrote:
> > > On Fri, Mar 11, 2022 at 11:36 PM Takashi Yano <takashi.yano@nifty.ne.jp> wrote:
> > > > I looked into this problem and found the cause.
> > > > This seems to be due to a bug of fsync(). Cygwin's fsync()
> > > > flushes the console input buffer unlike linux.
> > > >
> > > > I will propose a patch for this issue.
> > > >
> > > > --
> > > > Takashi Yano <takashi.yano@nifty.ne.jp>
> > >
> > > Thank you very much. Looks better now.
> > >
> > > I'm sorry for nudging, but on msys2 I still get frequent mistypes when
> > > typing fast.
> > >
> > > I (still) don't have a consistent reproduction, but if I get it
> > > correctly, it looks like one or more characters I type right when the
> > > prompt appears show up before the buffered characters.
> > >
> > > For instance, I run git fetch, and while it is running I type git
> > > status, *sometimes* 1-2 characters "pop" to the left, so I get
> > > something like tgit satus.
> > >
> > > I wasn't able to reproduce it with cygwin, but on msys2 (with cygwin
> > > 3.3 branch merged in) it happens to me all the time :/
> >
> > Thansk for the report.
> >
> > I cloned the msys2-runtime repository from
> > https://github.com/msys2/msys2-runtime
> > and applied patches in cygwin-3_3-branch against msys2-3_3_4-release
> > branch. The patches applied are listed in cygwin-3_3-branch-merged.log
> > attached. A few patches, which are not actually in cygwin-3_3-branch,
> > are also applied just for avoiding conflict easily.
> >
> > However, I cannot reproduce your problem. Have you surely applied the
> > following patches especially important for this issue?
> >
> > Could you please also check if the code of cons_master_thread() in
> > fhandler_console.cc exactly matches with cons_master_thread.cc attached?
>
> I also tried merge-3.3 branch from
> https://github.com/orgads/msys2-runtime-1 (perhaps it's your repository),
> and confirmed it works without the issue. What is the difference?
>
> I tried the following steps.
>
> 1) Start cmd.exe (command prompt).
> 2) Run \msys64\usr\bin\bash -l
> 3) cd msys2-runtime
> 4) git fetch
> 5) Quickly type "git status" before the shell prompt is shown.
> 6) Repeat 4) and 5) many times.

I'm using the dll that was built here:
https://github.com/git-for-windows/msys2-runtime/actions/runs/2000018081
for my PR: https://github.com/git-for-windows/msys2-runtime/pull/43

I can reproduce in msys2-runtime repo, but it's quite hard. Try this:
1. git fetch
2. While it is running, write git and then very quickly type
ququququququququququququququququ until the prompt appears.

Sometimes you'll get q or u before git.

- Orgad


More information about the Cygwin mailing list