On Thu, 28 Aug 2025 05:36:06 +0200
Thomas Wolff wrote:
> When running wsl.exe from mintty, typing ^O corrupts terminal display.
> This was reported in
> https://github.com/mintty/mintty/issues/1332
> and I later reported it towards Windows conpty
> https://github.com/microsoft/terminal/issues/19285
> but conpty is unlikely the cause, as testing suggests.
> 
> Test case, in mintty:
> wsl
> ls -1 /bin
> ^O # enter the control character
> ls -1 /bin # repeat
> 
> The same happens in xterm and some other terminals, but not all.
> 
> Mintty uses a loop to read terminal output from the pty and fill its buffer:
>          do {
>            int ret = read(pty_fd, buf + len, sizeof buf - len);
>            if (ret > 0)
>              len += ret;
>            else
>              break;
>          } while (len < sizeof buf);
> Tracing the loop shows that, while running wsl, after having entered ^O, 
> every subsequent read returns -1.
> Taking out the loop (by patching it, or currently by using option Baud 
> with some high value) fixes the problem.
> I suspect some very obscure interworking problem between wsl/conpty and 
> cygwin pty handling. As noted in the latter issue, it does not happen 
> with terminals running remotely, so the suspicion goes more to the 
> cygwin side.
> What’s the role of ^O in this puzzle? Does it trigger something in cygwin?
> Is there anything peculiar that would cause pty chunks not be recognised 
> and then skipped in such a loop?

Thanks for the report. I fixed the Ctrl^O (FLUSHO) handling.
Please try cygwin-3.7.0-dev-286-g7b5fb35e.

-- 
Takashi Yano <[email protected]>

-- 
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

Reply via email to