Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Route "Device Status Report" responses correctly #72

Merged
merged 2 commits into from
Dec 10, 2021

Conversation

dscho
Copy link
Collaborator

@dscho dscho commented Dec 10, 2021

As reported in git-for-windows/git#3579, when using MSYS2 runtime v3.3.3 in a regular Git Bash, after git config -e --global launched vim and the editor was closed, seemingly random characters are "ghost-typed". Concretely, I saw 1R77;30502;0c10;rgb:bfbf/bfbf/bfbf11;rgb:0000/0000/0000 being "ghost-typed" every time Git had called vi for editing a file.

To be precise, the hexdump -C output is this:

00000000  1b 5b 32 3b 32 52 1b 5b  33 3b 31 52 1b 5b 3e 37  |.[2;2R.[3;1R.[>7|
00000010  37 3b 33 30 35 30 32 3b  30 63 1b 5d 31 30 3b 72  |7;30502;0c.]10;r|
00000020  67 62 3a 62 66 62 66 2f  62 66 62 66 2f 62 66 62  |gb:bfbf/bfbf/bfb|
00000030  66 07 1b 5d 31 31 3b 72  67 62 3a 30 30 30 30 2f  |f..]11;rgb:0000/|
00000040  30 30 30 30 2f 30 30 30  30 07                    |0000/0000.|

This is the response for a CSI [ 6n request, and the response was clearly routed to the terminal by mistake instead of the process that requested it.

The regression was actually introduced into v3.2.0, but not noticed earlier. I reported the issue after trying to figure out a workaround for three days, without success, and the original author of the commit introducing the regression provided a patch that works around it. I do not yet understand the patch, but let's take the patch for now because the regression is pretty severe.

While at it, also include a fixup that handles two previously unhandled instances of the cygwin-pty pipe (which is renamed to msys-pty in MSYS2) that I spotted while working on this bug.

dscho and others added 2 commits December 10, 2021 12:36
These two instances of pty pipes have been forgotten somewhere along the
lines.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
When launching an MSYS2 process via a non-MSYS2 process, the response
for, say, a CSI [ 6n (Device Status Report) sent from that MSYS2 process
was sometimes not sent (or sent only partially) to the process but to
the terminal instead.

This regression was introduced in f206417 (Cygwin: pty: Reduce
unecessary input transfer., 2021-02-11).

While it is not yet completely clear why, this patch fixes this. The
explanation is left for the commit message that Takashi will craft for
the Cygwin project, but we will take this patch early into the MSYS2/Git
for Windows projects.

This addresses git-for-windows/git#3579
@dscho dscho requested a review from lazka December 10, 2021 12:05
@lazka lazka merged commit eb55475 into msys2:msys2-3_3_3-release Dec 10, 2021
@lazka
Copy link
Member

lazka commented Dec 10, 2021

-> msys2/MSYS2-packages#2730

@dscho dscho deleted the tty-fixups branch December 10, 2021 12:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants