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

Unsupported CSI, OSC or DEC private mode parsing is interrupted on a delay #3081

Closed
egmontkob opened this issue Oct 5, 2019 · 3 comments · Fixed by #4870
Closed

Unsupported CSI, OSC or DEC private mode parsing is interrupted on a delay #3081

egmontkob opened this issue Oct 5, 2019 · 3 comments · Fixed by #4870
Labels
Area-VT Virtual Terminal sequence support Issue-Bug It either shouldn't be doing this or needs an investigation. Needs-Tag-Fix Doesn't match tag requirements Product-Conpty For console issues specifically related to conpty Resolution-Fix-Committed Fix is checked in, but it might be 3-4 weeks until a release.

Comments

@egmontkob
Copy link

egmontkob commented Oct 5, 2019

Environment

Windows build number: Win32NT 10.0.18362.0
Windows Terminal version (if applicable): 0.5.2762.0

Steps to reproduce

Sibling issue of #3080. Execute this:

echo -ne '\e[?12'; sleep 1; echo -ne '34h'

Expected behavior

As if the delay wasn't there, this should attempt to enable DEC private mode 1234, which is unsupported by WT (actually undefined), so no action should be taken.

Actual behavior

34h is printed, suggesting that parsing the sequence got interrupted.

Note that if the given number is supported (e.g. 1049 to switch to the alternate screen) then the sequence is parsed and executed correctly even when a delay is injected.


Update:

The same goes for unsupported CSI modes too, e.g. \e[22;0;0t (save title on stack) or \e[4l (replace mode).

@ghost ghost added Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting Needs-Tag-Fix Doesn't match tag requirements labels Oct 5, 2019
@egmontkob egmontkob changed the title DEC unsupported private mode parsing is interrupted on a delay Unsupported CSI or DEC private mode parsing is interrupted on a delay Oct 5, 2019
@DHowett-MSFT DHowett-MSFT added Product-Conhost For issues in the Console codebase Area-VT Virtual Terminal sequence support Issue-Bug It either shouldn't be doing this or needs an investigation. labels Oct 6, 2019
@ghost ghost removed the Needs-Tag-Fix Doesn't match tag requirements label Oct 6, 2019
@DHowett-MSFT
Copy link
Contributor

Oh, this is interesting. We only flush the unknown/unparseable string that completed the sequence! That'll be the root cause for the sibling bug as well.

Thanks!

@DHowett-MSFT
Copy link
Contributor

(We successfully identify that we're dealing with \e[?1234h, but by the time we get the h we've lost the beginning as you've rightly surmised.)

@DHowett-MSFT DHowett-MSFT added Product-Conpty For console issues specifically related to conpty and removed Product-Conhost For issues in the Console codebase labels Oct 14, 2019
@DHowett-MSFT DHowett-MSFT added this to the Console Backlog milestone Oct 14, 2019
@DHowett-MSFT DHowett-MSFT removed the Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting label Oct 14, 2019
@egmontkob
Copy link
Author

Explicit hyperlinks (not yet supported: #204) are also affected in the same way (tested in 0.8.10091.0).

Test with:

cat hyperlink-demo.txt

The longer the target URL, the more likely the corruption occurs, but it is easily reproducible with short URLs too by injecting a delay.

This is likely to cause actual problems, since there's no way to detect (or advertise) hyperlink support, most of the apps just assume that the terminal at least silently ignores the sequence. See e.g. the recent discussion under the hyperlink spec.

@egmontkob egmontkob changed the title Unsupported CSI or DEC private mode parsing is interrupted on a delay Unsupported CSI, OSC or DEC private mode parsing is interrupted on a delay Jan 30, 2020
DHowett-MSFT pushed a commit that referenced this issue Mar 10, 2020
When we had to flush unknown sequences to the terminal, we were only
taking the _most recent run_ with us; therefore, if we received `\e[?12`
and `34h` in separate packets we would _only_ send out `34h`.

This change fixes that issue by ensuring that we cache partial bits of
sequences we haven't yet completed, just in case we need to flush them.

Fixes #3080.
Fixes #3081.
@ghost ghost added the In-PR This issue has a related PR label Mar 10, 2020
@ghost ghost added Needs-Tag-Fix Doesn't match tag requirements Resolution-Fix-Committed Fix is checked in, but it might be 3-4 weeks until a release. and removed In-PR This issue has a related PR labels Mar 11, 2020
DHowett-MSFT pushed a commit that referenced this issue Mar 11, 2020
When we had to flush unknown sequences to the terminal, we were only
taking the _most recent run_ with us; therefore, if we received `\e[?12`
and `34h` in separate packets we would _only_ send out `34h`.

This change fixes that issue by ensuring that we cache partial bits of
sequences we haven't yet completed, just in case we need to flush them.

Fixes #3080.
Fixes #3081.
abhijeetviswam pushed a commit to abhijeetviswam/terminal that referenced this issue Mar 12, 2020
When we had to flush unknown sequences to the terminal, we were only
taking the _most recent run_ with us; therefore, if we received `\e[?12`
and `34h` in separate packets we would _only_ send out `34h`.

This change fixes that issue by ensuring that we cache partial bits of
sequences we haven't yet completed, just in case we need to flush them.

Fixes microsoft#3080.
Fixes microsoft#3081.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-VT Virtual Terminal sequence support Issue-Bug It either shouldn't be doing this or needs an investigation. Needs-Tag-Fix Doesn't match tag requirements Product-Conpty For console issues specifically related to conpty Resolution-Fix-Committed Fix is checked in, but it might be 3-4 weeks until a release.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants