[Bug 49780] New: wineconsole reports VT sequence support when it does not
https://bugs.winehq.org/show_bug.cgi?id=49780 Bug ID: 49780 Summary: wineconsole reports VT sequence support when it does not Product: Wine Version: 5.16 Hardware: x86-64 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: cmd Assignee: wine-bugs(a)winehq.org Reporter: magiblot(a)hotmail.com Distribution: --- Created attachment 68092 --> https://bugs.winehq.org/attachment.cgi?id=68092 Demo application to reproduce the issue Wineconsole does not support applications writing Virtual Terminal sequences through the Console API. That's fine. However, when enabling the console ENABLE_VIRTUAL_TERMINAL_PROCESSING mode on stdout with SetConsoleMode, no error is returned, so the application has no way to detect whether VT sequences are supported or not. This is documented in https://docs.microsoft.com/en-us/windows/console/setconsolemode. The port of Turbo Vision at https://github.com/magiblot/tvision is affected by this. When using the Console API, Turbo Vision prefers VT sequences over SetConsoleCursorPosition/SetConsoleTextAttribute for code reusability and performance. Nevertheless, it can fall back to the latter method when SetConsoleMode fails to enable either ENABLE_VIRTUAL_TERMINAL_PROCESSING or DISABLE_NEWLINE_AUTO_RETURN. Since SetConsoleMode does not return error on wineconsole, garbage is shown instead of a colorful interface. STEPS TO REPRODUCE To reproduce the issue on Turbo Vision: (A) - Using the attached 'tvdemo.exe' 1. Run the application on wineconsole. You should see a black-and-white background and escape sequences drawn on the console. 2. Press Alt+F, then D. You should see the command prompt, and the message "VT enabled" at the top, which demonstrates the issue in SetConsoleMode. (B) - Compiling from source code (requires up-to-date CMake and MSVC). 1. Insert the following code after line 63 in source/linux/win32con.cpp (https://github.com/magiblot/tvision/blob/dd4e410e60a34e08053399e346d4ed4e632...): ``` if (supportsVT) cerr << "VT enabled" << endl; else cerr << "VT not enabled: " << GetLastError() << endl; ``` 2. Follow the build instructions at https://github.com/magiblot/tvision/blob/dd4e410e60a34e08053399e346d4ed4e632... 3. Follow the steps in (A). EXPECTED BEHAVIOUR On Windows, support for VT sequences can be disabled by turning on the "Legacy Console" mode. If tvdemo.exe is ran in these conditions, the interface is displayed properly. If entering the command prompt by pressing Alt+F, then D, the message "VT not enabled: 87" is displayed (error 87 stands for ERROR_INVALID_PARAMETER), which is what should be shown on wineconsole as well, since it clearly does not support VT sequences. Thank you! -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=49780 --- Comment #1 from magiblot <magiblot(a)hotmail.com> --- Created attachment 68093 --> https://bugs.winehq.org/attachment.cgi?id=68093 Screenshot of VT sequences causing garbage on wineconsole -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=49780 --- Comment #2 from magiblot <magiblot(a)hotmail.com> --- Created attachment 68094 --> https://bugs.winehq.org/attachment.cgi?id=68094 Screenshot showing "VT enabled" message because of SetConsoleMode success -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=49780 --- Comment #3 from magiblot <magiblot(a)hotmail.com> --- Created attachment 68095 --> https://bugs.winehq.org/attachment.cgi?id=68095 Screenshot of "VT not enabled" message on Windows' Legacy Console -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=49780 magiblot <magiblot(a)hotmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|wineconsole reports VT |wineconsole mistakenly |sequence support when it |reports VT sequence support |does not | -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=49780 Louis Lenders <xerox.xerox2000x(a)gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |download Ever confirmed|0 |1 URL| |https://bugs.winehq.org/att | |achment.cgi?id=68092 Status|UNCONFIRMED |NEW CC| |xerox.xerox2000x(a)gmail.com --- Comment #4 from Louis Lenders <xerox.xerox2000x(a)gmail.com> --- Hi, thanks for the very detailed bugreport; confirming + add some info I don`t know how to fix this bug properly, but just wanted to mention that Powershell Core 7.* seems to suffer from same bug: garbage on wineconsole (https://github.com/PowerShell/PowerShell/releases/download/v7.0.3/PowerShell...) I verfied that adding a hack in SetConsoleMode makes the appearance in wineconsole look fine for this app ( hack added something along the lines: if (mode & 0x4 !=0) return FALSE) I guess this should be fixed somewhere in server code, hopefully someone more familiar with this could take this up -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=49780 Jacek Caban <jacek(a)codeweavers.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jacek(a)codeweavers.com --- Comment #5 from Jacek Caban <jacek(a)codeweavers.com> --- There is room for improvements in SetConsoleMode arguments validation, but the right solution for this bug is to implement support for ENABLE_VIRTUAL_TERMINAL_PROCESSING rather than improving reporting that it's missing. -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=49780 --- Comment #6 from magiblot <magiblot(a)hotmail.com> --- As it looks like it can take a long time before support for ENABLE_VIRTUAL_TERMINAL_PROCESSING is implemented, it may be worth considering to solve the parameter validation issue first. -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=49780 Ron Yorston <rmy(a)pobox.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |rmy(a)pobox.com --- Comment #7 from Ron Yorston <rmy(a)pobox.com> --- I agree with magiblot, fixing the parameter validation is a good first step. There's nothing *wrong* with a console that doesn't support Virtual Terminal sequences. That's how it has been on most versions of Windows until recently. But failing to report that the Wine console *doesn't* (currently) support VT is problematic for applications. My interest here is that I maintain a port of BusyBox to Windows (https://frippery.org/busybox). I've recently changed its default behaviour so it calls SetConsoleMode to determine whether VT sequences are supported. If they are (as with recent Windows 10 consoles) it uses them, if not it uses the console API to emulate them. This results in ugly escape sequences being visible in the Wine console. There is a workaround: it's possible to set an environment variable to turn off the auto-detection of VT support. But it would be better if SetConsoleMode was more accurate in its response. -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=49780 KOLANICH <kolan_n(a)mail.ru> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |kolan_n(a)mail.ru --- Comment #8 from KOLANICH <kolan_n(a)mail.ru> --- IMHO wineconsole own GUI should be retired and instead open system terminal emulator, such as Konsole. -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=49780 peter0x44(a)disroot.org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |peter0x44(a)disroot.org -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=49780 Eric Pouech <eric.pouech(a)gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |megastallman(a)gmail.com --- Comment #9 from Eric Pouech <eric.pouech(a)gmail.com> --- *** Bug 57468 has been marked as a duplicate of this bug. *** -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
http://bugs.winehq.org/show_bug.cgi?id=49780 Eric Pouech <eric.pouech(a)gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |forestix(a)gaga.casa --- Comment #10 from Eric Pouech <eric.pouech(a)gmail.com> --- *** Bug 58665 has been marked as a duplicate of this bug. *** -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
http://bugs.winehq.org/show_bug.cgi?id=49780 --- Comment #11 from Forest <forestix(a)gaga.casa> --- Created attachment 79366 --> http://bugs.winehq.org/attachment.cgi?id=79366 bug 58665 reproducer: should print 3 lines; wine prints 4 lines This is a reproducer for bug 58665: "cmd incorrectly wraps text containing ANSI escape sequences". That bug was closed as a duplicate of this one, reducing the visibility of its different symptoms. I am therefore posting the reproducer here, in hopes that these symptoms will be noticed and solved. This batch file prints 3 lines of text, each with the same 79 printable characters. The second line includes some ANSI escape sequences to change the first couple of characters' color. Ideally, the output should look like this, with the head of line 2 in red: 79 chars _123456789_123456789_123456789_123456789_123456789_123456789_123456789 79 chars _123456789_123456789_123456789_123456789_123456789_123456789_123456789 79 chars _123456789_123456789_123456789_123456789_123456789_123456789_123456789 In Wine, when the output is a terminal window (not wineconsole), the output looks like this: 79 chars _123456789_123456789_123456789_123456789_123456789_123456789_123456789 79 chars _123456789_123456789_123456789_123456789_123456789_123456789_12 3456789 79 chars _123456789_123456789_123456789_123456789_123456789_123456789_123456789 Note that the second line is prematurely wrapped. Wine is apparently passing the batch file's output to the unix terminal, which can handle the unprintable escape codes, but Wine is also corrupting the output by inserting a line break that is not present in the batch file's output. I am aware that this problem is not the same as wineconsole's lack of virtual terminal processing. If that means it should be in a separate report, then I invite the maintainers to re-open bug 58665. -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
participants (1)
-
WineHQ Bugzilla