https://bugs.winehq.org/show_bug.cgi?id=53386
Bug ID: 53386 Summary: cmd.exe: FOR /F USEBACKQ doesn't handle UTF-16 output of commands. Product: Wine Version: 7.13 Hardware: x86-64 OS: Linux Status: UNCONFIRMED Severity: minor Priority: P2 Component: cmd Assignee: wine-bugs@winehq.org Reporter: ahiler@codeweavers.com Distribution: ---
Used by installation script of Septerra Core on Steam.
Easy reproducer:
FOR /F USEBACKQ %F IN (`wmic os get osarchitecture`) DO ECHO %F
Wmic output is UTF-16 and starts with BOM. On Windows the above snipped echoes whatever wmic spits out. Currently on Wine it gets stuck in infinite loop.
The infinite loop is addressed by https://gitlab.winehq.org/wine/wine/-/merge_requests/352 but UTF-16 is still not handled at all.
https://bugs.winehq.org/show_bug.cgi?id=53386
Eric Pouech eric.pouech@orange.fr changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |eric.pouech@orange.fr
--- Comment #1 from Eric Pouech eric.pouech@orange.fr --- Created attachment 72777 --> https://bugs.winehq.org/attachment.cgi?id=72777 patch
Hi Arek,
thanks for the report
additional testing on Windows show that a command file (.bat), written in UNICODE with BOM is executed with ANSI read operations
hence current implementation of builtin cmd.exe (where all line reading is done in WCMD_fgets) fails apart
this attached patch solves the first issue of infinite loop
it may well be that it could solve this very unicode issue would you mind testing it?
A+
https://bugs.winehq.org/show_bug.cgi?id=53386
--- Comment #2 from Arek Hiler ahiler@codeweavers.com --- I've gave the attached diff a spin and it helps.
``` Z:\home\ivyl.local\share\Steam\steamapps\common\Septerra Core>FOR /F USEBACKQ %F IN (`wmic os get osarchitecture`) DO ECHO %F OSArchitecture 64-bit ```
Also checked with Septerra Core and no hand on the install scripts.
Thanks!
https://bugs.winehq.org/show_bug.cgi?id=53386
Eric Pouech eric.pouech@orange.fr changed:
What |Removed |Added ---------------------------------------------------------------------------- Attachment #72777|0 |1 is obsolete| |
--- Comment #3 from Eric Pouech eric.pouech@orange.fr --- Created attachment 72792 --> https://bugs.winehq.org/attachment.cgi?id=72792 patch
good news... here's a cleaned up version of the patch; you can freely embed it in the MR
thx
https://bugs.winehq.org/show_bug.cgi?id=53386
--- Comment #4 from Eric Pouech eric.pouech@gmail.com --- likely fixed by 92e4cad8e08b64fc0e66c2a275896e2c1de45eba
https://bugs.winehq.org/show_bug.cgi?id=53386
Gijs Vermeulen gijsvrm@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |FIXED Status|UNCONFIRMED |RESOLVED Fixed by SHA1| |92e4cad8e08b64fc0e66c2a2758 | |96e2c1de45eba
--- Comment #5 from Gijs Vermeulen gijsvrm@gmail.com --- Reproducer works correctly with wine-8.0:
[gverm@gverm-ThinkPad ~]$ WINEDEBUG=-all wine cmd Microsoft Windows 6.1.7601
Z:\home\gverm>FOR /F USEBACKQ %F IN (`wmic os get osarchitecture`) DO ECHO %F OSArchitecture 64-bit
Z:\home\gverm>
Marking FIXED.
https://bugs.winehq.org/show_bug.cgi?id=53386
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #6 from Alexandre Julliard julliard@winehq.org --- Closing bugs fixed in 8.1.