X-Recipient: archive-cygwin@delorie.com
X-Original-To: cygwin@cygwin.com
Delivered-To: cygwin@cygwin.com
DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 878BE388451F
Authentication-Results: sourceware.org;
 dmarc=fail (p=none dis=none) header.from=nifty.ne.jp
Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=nifty.ne.jp
DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-03.nifty.com 22I5MW2D009030
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.ne.jp;
 s=dec2015msa; t=1647580952;
 bh=tc3Yjb62y1+HH2mWm1t0t8jsLBEYnINAgaq9gZ7F5bY=;
 h=Date:From:To:Cc:Subject:In-Reply-To:References:From;
 b=tmejWMeftXxPBAaI9ApUvZAJk5Ys41SkzXBjp778yJvkOf01s22bQN/VcceQv6qe+
 DtQNzXhGjUcHZZ69fEV3Xk1NnP+ytpJ/HtlMmmARWOR9qHqPiuEGV4Yhtnz56uN3B0
 TJfYuNq9Xj4gxCW3rsU2hfubGz1JBklSW+2eMX6b7O5DA6nTkIHxI4QCaWG/Kg2NL8
 9aFiEpsP1kpwDSz0rgsJlsQSTAiEtIszCvpYDqFyOiAGepCYPCpi8ur3hxGdrL6E9n
 YotRqhnpJez8mSPy8ecl2RP0tHYhCyMu/2F5Dt57ExA9tOXG38M/DVXgkNS8/K0HiZ
 G6JuQwkbk3SpA==
X-Nifty-SrcIP: [119.150.36.16]
Date: Fri, 18 Mar 2022 14:22:43 +0900
From: Takashi Yano <takashi.yano@nifty.ne.jp>
To: cygwin@cygwin.com
Subject: Re: Typed characters are mis-ordered when CPU usage is high
Message-Id: <20220318142243.1751c742ebaae47e8fba9b47@nifty.ne.jp>
In-Reply-To: <20220318132335.d5635fe9fc782ed53bddf7bc@nifty.ne.jp>
References: <CAGHpTBKbqxWQ+WOc=UZH1a155gHhNc4ogVE0sP=rCw7q5xoNpQ@mail.gmail.com>
 <20220227235303.5d6239724ed83b145772134b@nifty.ne.jp>
 <20220302081259.2a7e522ef1a9e3e6da0aa259@nifty.ne.jp>
 <CAGHpTBLc9waVzjKWb84C5KS+s9uKENrOMAxxfBBrvPR-zKKtPQ@mail.gmail.com>
 <20220303090208.4a04e35756b7868fe9b4701d@nifty.ne.jp>
 <CAGHpTBKU5XQJ6mjsvb94LnbJb5xj3uoRMtt3KgsMx1NjpM5hSg@mail.gmail.com>
 <20220312063625.9ca3d42d4e2e941a13fa7909@nifty.ne.jp>
 <CAGHpTBLe0D9gQaK=4A91w5eravsygpWe001DhcB=hhrcLx6YWA@mail.gmail.com>
 <20220318132335.d5635fe9fc782ed53bddf7bc@nifty.ne.jp>
X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.30; i686-pc-mingw32)
Mime-Version: 1.0
X-Spam-Status: No, score=-4.8 required=5.0 tests=BAYES_00, DKIM_SIGNED,
 DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, NICE_REPLY_A, RCVD_IN_DNSWL_NONE,
 SPF_HELO_NONE, SPF_PASS, TXREP,
 T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4
X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on
 server2.sourceware.org
X-BeenThere: cygwin@cygwin.com
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Unsubscribe: <https://cygwin.com/mailman/options/cygwin>,
 <mailto:cygwin-request@cygwin.com?subject=unsubscribe>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-request@cygwin.com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
 <mailto:cygwin-request@cygwin.com?subject=subscribe>
Cc: Orgad Shaneh <orgads@gmail.com>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: cygwin-bounces+archive-cygwin=delorie.com@cygwin.com
Sender: "Cygwin" <cygwin-bounces+archive-cygwin=delorie.com@cygwin.com>

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.

-- 
Takashi Yano <takashi.yano@nifty.ne.jp>

-- 
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple
