From: Takashi Yano <takashi.yano@nifty.ne.jp>
To: cygwin-developers@cygwin.com
Subject: Re: Rare character glitch in pty?
Date: Wed, 2 Aug 2023 22:16:07 +0900 [thread overview]
Message-ID: <20230802221607.f698130b47973bb39e11a647@nifty.ne.jp> (raw)
In-Reply-To: <20230802170043.61db96e557d4fb742703ec30@nifty.ne.jp>
Hi Thomas,
On Wed, 2 Aug 2023 17:00:43 +0900
Takashi Yano wrote:
> On Wed, 2 Aug 2023 08:32:39 +0200
> Thomas Wolff <wrote:
> > Am 02.08.2023 um 00:35 schrieb Takashi Yano:
> > > On Tue, 1 Aug 2023 23:05:18 +0200
> > > Thomas Wolff wrote:
> > >> I had reported this to the the main cygwin list:
> > >>
> > >> Am 20.07.2023 um 08:33 schrieb Thomas Wolff via Cygwin:
> > >>> There was a report that on switching terminal windows with the mouse,
> > >>> focus event reports (as enabled with ESC[?1004h) would sometimes get
> > >>> mangled.
> > >>> This is further described in issue reports to mintty/wsltty
> > >>> (https://github.com/mintty/wsltty/issues/335) and also to tmux
> > >>> (https://github.com/tmux/tmux/issues/3601).
> > >>>
> > >>> I could reproduce the issue without either of tmux or WSL. However, it
> > >>> happens only once in a few hundred instances:
> > >>> The escape sequence is changed so that the initial ESC is replaced by
> > >>> one of the two subsequent characters, so instead of ESC[O, either of
> > >>> [[O or sometimes O[O would be sent to the foreground application.
> > >>>
> > >>> I traced the issue down to the pty that connects mintty and its client
> > >>> application, verified that the correct sequence is passed into write()
> > >>> at the pty and the mangled sequence appears at read() in the client
> > >>> process. In addition to a minimised test program that behaves like
> > >>> `cat -v`, I also also put the test output directly into the client
> > >>> process within the mintty code.
> > >>> This leaves the only conclusion that the issue must be happening
> > >>> somehow within pty handling, maybe in the context of some timing
> > >>> condition or Windows messages being passed to mintty.
> > >>> Anyhow, I was about to prepare testing with older mintty versions, in
> > >>> case I overlooked something, when the OP reported that the issue does
> > >>> not happen with cygwin 3.2.0.
> > >>> Is there any recent change that could possibly cause such weird
> > >>> behaviour?
> > >>> Thomas
> > >>>
> > >> I have now automated the test case to chase the issue and associate it
> > >> with a cygwin version. As unlikely as it may appear, results suggest
> > >> that there is a case within the pty handling that may change sequences
> > >> sent through it once in a while, more likely on a system under heavy load.
> > >> I took some of the latest cygwin snapshots (by the way, there are no
> > >> newer ones on the snapshots page):
> > >> I can reproduce the issue with
> > >> 3.3.5-341.x86_64.snap 2022-02-17 11:53 UTC
> > >> while it did not occur with
> > >> 3.4.0-341.x86_64.snap 2022-01-27 14:34 UTC
> > >> Weird enough, the failing newer one is a cygwin 3.3.5 although the older
> > >> one is a 3.4.0 version.
> > > Can you provide the automated test case? I would like to
> > > investigate what is happning.
> >
> > Manual test case:
> > 1. Run `mintty echokey1` with the attached test program that runs like
> > `cat -v` and detects the glitch
> > 2. Run a second test window, same setup to increase the hit rate
> > 3. Switch these 2 windows by clicking them in change a few hundred
> > times, until the test program outputs "FAIL"
>
> Thanks for the test case. The manual test case did not output "FAIL"
> while 500 forcus-chages in my environment (cygwin 3.4.7).
>
> > Automated test case:
> > 1. Use the tool TinyTask (https://www.tinytask.net/) to save the
> > clicking. Sorry, I didn't manage to replace this with a self-made click
> > simulator.
> > 2. Place the 2 test windows in a specific position (e.g. covering the
> > two screen halves in a top position)
> > 3. Use the Record function of the tool and click to switch windows a
> > dozen times, stop recording
> > 4. Save the sequence as a TinyTask script, or use mine (2w.rec
> > attached), better: load the script (Open), then create a standalone test
> > executable (button "exe") to create tinytask2w.exe (I can send that to
> > you if you like)
> > 5. Optionally, create some background load on your system
> > 6. Minimize other windows in case the test script does not hit the test
> > windows
> > 7. Run the test script minptytest (attached) to start the 2 windows and
> > run the TinyTask standalone test in a loop; the script detects a marker
> > file created by the test program; it also detect premature termination
> > of a window (e.g. by hitting ^D in it)
>
> I will try automated test case next for longer test time.
The issue did not happen for about three hours with your
automated test case in my environment.
I beleave you mean it happens even with cygwin 3.4.7 in your
environment. Right?
--
Takashi Yano <takashi.yano@nifty.ne.jp>
next prev parent reply other threads:[~2023-08-02 13:16 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <6f0bfdf8-a557-0540-0367-6846406f941d@towo.net>
2023-08-01 21:05 ` Thomas Wolff
2023-08-01 21:27 ` Corinna Vinschen
2023-08-02 6:36 ` cygwin build Thomas Wolff
2023-08-02 6:42 ` Takashi Yano
2023-08-02 8:09 ` Corinna Vinschen
2023-08-03 8:21 ` Thomas Wolff
2023-08-03 13:12 ` Jon Turney
2023-08-05 18:18 ` Thomas Wolff
2023-08-05 22:20 ` Takashi Yano
2023-08-06 6:51 ` Thomas Wolff
2023-08-06 18:53 ` Jon Turney
2023-08-07 6:11 ` Thomas Wolff
2023-08-07 8:25 ` Corinna Vinschen
2023-08-03 13:13 ` Jon Turney
2023-08-01 22:35 ` Rare character glitch in pty? Takashi Yano
2023-08-02 6:32 ` Thomas Wolff
2023-08-02 8:00 ` Takashi Yano
2023-08-02 13:16 ` Takashi Yano [this message]
2023-08-04 8:52 ` Takashi Yano
2023-08-04 11:33 ` Takashi Yano
2023-08-05 7:53 ` Thomas Wolff
2023-08-05 8:10 ` Takashi Yano
2023-08-07 8:28 ` Corinna Vinschen
2023-08-07 11:38 ` Takashi Yano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230802221607.f698130b47973bb39e11a647@nifty.ne.jp \
--to=takashi.yano@nifty.ne.jp \
--cc=cygwin-developers@cygwin.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).