Escape sequences in unit test log comments are being interpreted #22107

Closed
opened 2026-01-31 08:03:38 +00:00 by claunia · 3 comments
Owner

Originally created by @j4james on GitHub (Aug 18, 2024).

Windows Terminal version

Commit 9b21b78fee

Windows build number

10.0.19045.4780

Other Software

No response

Steps to reproduce

  1. Get the latest source (I suspect it needs to be 4c018efd64 or later)

  2. Build the project

  3. From a cmd shell1 , run the VtResize unit test.

    runut /name:ScreenBufferTests::VtResize
    

Expected Behavior

You should see the test log output as usual.

Actual Behavior

The output appears to be clamped to a corner of the screen.

image

If you have a look at the source for that test, you'll notice there are escape sequences in several of the log comments. For example, see here:
https://github.com/microsoft/terminal/blob/main/src/host/ut_host/ScreenBufferTests.cpp#L1173-L1176

I'm guessing what's happening is that those escape sequences are now being interpreted, which causes the conhost buffer to be resized, and that ends up screwing up the output.

This only started happening very recently, and that test has been around for ages, so I'm assuming it's got something to do with the TAEF upgrade in PR #16595.


  1. I'm not sure it has to be a cmd shell, but that's all I ever use. ↩︎

Originally created by @j4james on GitHub (Aug 18, 2024). ### Windows Terminal version Commit 9b21b78feea9ff0a0b9ff2c8fa4b4aa5602d3889 ### Windows build number 10.0.19045.4780 ### Other Software _No response_ ### Steps to reproduce 1. Get the latest source (I suspect it needs to be 4c018efd641dd71502e4019078bb6325c68b7f9a or later) 2. Build the project 3. From a cmd shell[^1], run the `VtResize` unit test. ``` runut /name:ScreenBufferTests::VtResize ```` [^1]: I'm not sure it _has_ to be a cmd shell, but that's all I ever use. ### Expected Behavior You should see the test log output as usual. ### Actual Behavior The output appears to be clamped to a corner of the screen. ![image](https://github.com/user-attachments/assets/bdcedc1b-98c5-431c-a563-21b7e3458ef3) If you have a look at the source for that test, you'll notice there are escape sequences in several of the log comments. For example, see here: https://github.com/microsoft/terminal/blob/main/src/host/ut_host/ScreenBufferTests.cpp#L1173-L1176 I'm guessing what's happening is that those escape sequences are now being interpreted, which causes the conhost buffer to be resized, and that ends up screwing up the output. This only started happening very recently, and that test has been around for ages, so I'm assuming it's got something to do with the TAEF upgrade in PR #16595.
claunia added the Issue-BugIn-PRNeeds-Tag-FixProduct-TerminalArea-Quality labels 2026-01-31 08:03:39 +00:00
Author
Owner

@DHowett commented on GitHub (Aug 18, 2024):

Ugh, I was just thinking about this today. Some version of it has been lurking forever, and I was wondering if our test framework has a way for us to override the output formatter.

@DHowett commented on GitHub (Aug 18, 2024): Ugh, I was just thinking about this today. Some version of it has been lurking forever, and I was wondering if our test framework has a way for us to override the output formatter.
Author
Owner

@j4james commented on GitHub (Aug 18, 2024):

It may be easier just to go through and escape the few places that are using control characters in those log comments. I'm hoping there aren't that many, because I noticed that some of them were already escaped. Just patching the VtResize test was enough to get a normalish run, although at one point the terminal minimized itself, so I'm assuming there's also at least one unescaped CSI 2 t sequence lurking somewhere.

@j4james commented on GitHub (Aug 18, 2024): It may be easier just to go through and escape the few places that are using control characters in those log comments. I'm hoping there aren't that many, because I noticed that some of them were already escaped. Just patching the `VtResize` test was enough to get a normalish run, although at one point the terminal minimized itself, so I'm assuming there's also at least one unescaped `CSI 2 t` sequence lurking somewhere.
Author
Owner

@DHowett commented on GitHub (Aug 18, 2024):

All of the ones that validate ReturnResponse, as well as the mouse encoding ones, will fall into that bucket too. You’re probably right, however.

@DHowett commented on GitHub (Aug 18, 2024): All of the ones that validate ReturnResponse, as well as the mouse encoding ones, will fall into that bucket too. You’re probably right, however.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#22107