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

QEMU -noconsole prints ANSI escape codes #12649

Closed
rayzchen opened this issue Mar 9, 2022 · 16 comments
Closed

QEMU -noconsole prints ANSI escape codes #12649

rayzchen opened this issue Mar 9, 2022 · 16 comments
Labels
Issue-Bug It either shouldn't be doing this or needs an investigation. Resolution-Duplicate There's another issue on the tracker that's pretty much the same thing.

Comments

@rayzchen
Copy link

rayzchen commented Mar 9, 2022

Windows Terminal version

1.13.10395.0

Windows build number

10.0.19042.1526

Other Software

QEMU emulator version 6.2.0 (v6.2.0-11889-g5b72bf03f5-dirty)

Steps to reproduce

qemu-system-x86_64 -nographic

Expected Behavior

something similar to the output of this window:

image

Actual Behavior

←c←[?7l←[2J←[0mSeaBIOS (version rel-1.15.0-0-g2dd4b9b3f840-prebuilt.qemu.org)


iPXE (http://ipxe.org) 00:03.0 CA00 PCI2.10 PnP PMM+07F915B0+07EF15B0 CA00



Booting from Hard Disk...
Boot failed: could not read the boot disk

Booting from Floppy...
Boot failed: could not read the boot disk

Booting from DVD/CD...
Boot failed: Could not read from CDROM (code 0003)
Booting from ROM...
iPXE (PCI 00:03.0) starting execution...ok
iPXE initialising devices...ok

ANSI codes don't seem to render properly, for example ←[0;1miPXE which should be iPXE in bold.

@rayzchen rayzchen added the Issue-Bug It either shouldn't be doing this or needs an investigation. label Mar 9, 2022
@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 Mar 9, 2022
@zadjii-msft
Copy link
Member

Looks like QEMU isn't enabling ENABLE_VIRTUAL_TERMINAL_PROCESSING with SetConsoleMode. If they want to use VT sequences, they'll need to set that flag. If this worked before, then it must be a recent regression in QEMU...

unless... how are you launching QEMU? Via a Terminal profile, or just by running the exe directly (from like the start menu or run dialog)? Do and I remember there being talk that Terminal should enable that flag by default for applications is spawns, but I don't kn

Nevermind. I thought this might be a defterm bug but you're on Windows 10 so it can't be that. I bet this is a regression in QEMU, we haven't changed this in years.

@rayzchen
Copy link
Author

rayzchen commented Mar 9, 2022

is there a way to force QEMU to enable that flag?

@zadjii-msft
Copy link
Member

zadjii-msft commented Mar 11, 2022

See, that's the interesting part. If you're running QEMU in the Windows Terminal, then ENABLE_VIRTUAL_TERMINAL_PROCESSING should be set by default. Only way the above would happen is if they actually disabled that mode explicitly. I'd reckin this is a bug that needs to go to their issue tracker.

Can you post a screenshot of the Terminal with the (broken) QEMU output?

idly: I wonder if they ship like, mintty with QEMU to use that as their console window.

There might be a reg key to force VT on by default, I forget off the top of my head, and I don't think it works in the Terminal (because again, the Terminal should enable that flag itself by default)

@zadjii-msft zadjii-msft added the Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something label Mar 11, 2022
@ghost ghost added the No-Recent-Activity This issue/PR is going stale and may be auto-closed without further activity. label Mar 15, 2022
@ghost
Copy link

ghost commented Mar 15, 2022

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.

@hello-smile6
Copy link

reg key to force VT on by default

Is this it?
https://www.dostips.com/forum/viewtopic.php?t=9144

@ghost ghost removed the No-Recent-Activity This issue/PR is going stale and may be auto-closed without further activity. label Mar 16, 2022
@zadjii-msft
Copy link
Member

Yep that's the one I was thinking of.

@ghost ghost added the No-Recent-Activity This issue/PR is going stale and may be auto-closed without further activity. label Mar 20, 2022
@ghost
Copy link

ghost commented Mar 20, 2022

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.

@hello-smile6
Copy link

It seems reproducible with the latest npm in conhost.

@ghost ghost removed the No-Recent-Activity This issue/PR is going stale and may be auto-closed without further activity. label Mar 20, 2022
@eryksun
Copy link

eryksun commented Mar 21, 2022

Only way the above would happen is if they actually disabled that mode explicitly.

I'm sure lots of programs set a hard-coded value. After all, it's not as if the console API ever changes. ;-) It would have been good to protect it with something like ENABLE_EXTENDED_FLAGS (0x0080) that's required in order to set and unset the VT modes.

@hello-smile6
Copy link

Could qemu be detected based on its hash or something? If so, maybe you could ignore its configuration.

@rayzchen
Copy link
Author

rayzchen commented Mar 21, 2022

image

Can you post a screenshot of the Terminal with the (broken) QEMU output?

Sorry for the absurdly late reply...

@ghost ghost added Needs-Attention The core contributors need to come back around and look at this ASAP. and removed Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something labels Mar 21, 2022
@hello-smile6
Copy link

image

Can you post a screenshot of the Terminal with the (broken) QEMU output?

Sorry for the absurdly late reply...

I was hoping the issue wouldn't be automatically closed, so I kept commenting.

@YO4
Copy link

YO4 commented Mar 23, 2022

I found how to reproduce.

cmd.exe on Windows Terminal, chcp 437 and run msys's bash.exe. Then run qemu and it will reproduce.

chcp 1252, chcp 932 or without msys bash, qemu works fine on Windows Terminal.

note: msys uses /c/ProgramData path notation.

@zadjii-msft
Copy link
Member

Huh, kinda surprised we never came back to this. The involvement with msys here makes me think this is a variation on #6634. @DHowett back me up?

@zadjii-msft zadjii-msft added Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something and removed Needs-Attention The core contributors need to come back around and look at this ASAP. labels Aug 12, 2022
@DHowett
Copy link
Member

DHowett commented Aug 12, 2022

Agreed, this looks like a /dupe of #6634, and it's something that the upstream application is going to need to handle better.

@ghost
Copy link

ghost commented Aug 12, 2022

Hi! We've identified this issue as a duplicate of another one that already exists on this Issue Tracker. This specific instance is being closed in favor of tracking the concern over on the referenced thread. Thanks for your report!

@ghost ghost closed this as completed Aug 12, 2022
@ghost ghost removed the Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting label Aug 12, 2022
@ghost ghost added Resolution-Duplicate There's another issue on the tracker that's pretty much the same thing. and removed Needs-Tag-Fix Doesn't match tag requirements Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something labels Aug 12, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue-Bug It either shouldn't be doing this or needs an investigation. Resolution-Duplicate There's another issue on the tracker that's pretty much the same thing.
Projects
None yet
Development

No branches or pull requests

6 participants