https://bugs.winehq.org/show_bug.cgi?id=57615
Bug ID: 57615 Summary: winetricks-test failing after recent cmd parsing changes Product: Wine Version: 9.12 Hardware: x86-64 OS: Linux Status: NEW Keywords: download, regression, source Severity: normal Priority: P2 Component: cmd Assignee: wine-bugs@winehq.org Reporter: austinenglish@gmail.com CC: eric.pouech@gmail.com Regression SHA1: bf9a465e9566578b40c08223436ce53f597bedd0 Distribution: Debian
Created attachment 77733 --> https://bugs.winehq.org/attachment.cgi?id=77733 stripped down winetricks-test showing the problem
https://github.com/Winetricks/winetricks/issues/2312
bf9a465e9566578b40c08223436ce53f597bedd0 is the first bad commit commit bf9a465e9566578b40c08223436ce53f597bedd0 (HEAD) Author: Eric Pouech epouech@codeweavers.com Date: Thu Jun 27 16:21:35 2024 +0200
cmd: Implement semantic for chaining in ||, | and && operators.
Signed-off-by: Eric Pouech epouech@codeweavers.com
programs/cmd/tests/test_builtins.cmd.exp | 106 +++++++++++++++++++++++++++++++++++++++++++++++++++++----------------------------------------------------- programs/cmd/wcmd.h | 2 ++ programs/cmd/wcmdmain.c | 42 ++++++++++++++++++++++++++++++++++++++---- 3 files changed, 93 insertions(+), 57 deletions(-)
After this commit, winetricks-test fails (it's failing when trying to run): wine cmd.exe /c "chcp 65001 > nul && echo %AppData%"
Running that same command directly in winetricks (i.e., outside of winetricks-test works fine).
I narrowed down the winetricks-test script, and found that it's failing whenever stdin is redirected (winetricks-test gets the list of winetricks commands to run, filters out anything blacklisted, then writes that to a file that is then read in a loop to run the tests).
Removing `chcp 65001 > nul &&` also serves as a workaround (that was recently added to improve support for a unicode username, https://github.com/Winetricks/winetricks/pull/2278).
I'm not sure what the proper fix is here (or if it's a wine/winetricks problem).
https://bugs.winehq.org/show_bug.cgi?id=57615
--- Comment #1 from Eric Pouech eric.pouech@gmail.com --- what happens is that the 'chcp 65001' command returns a non-zero value when run through winetricks-test (and doesn't when run directly)
this very likely is a sign that the cmd.exe instance (from which the 'chcp 65001' command is run) isn't attached to any console
this happens when a wine process is started from command line and none of the stdin/stdout/stderr being bound to a unix console
(and the unix console being the shell from which winetricks-test is run from)
the mentionned patch does the "right" think (compared to windows behavior) and AFAICT native chcp also fails when not bound to a console. It likely handles a bit differently success/failure of RHS in && operator.
the remaining potential solutions:
1) ensure that at least one of the three std handles is bound to console
I couldn't simply find a place where all three redirections are set at once (likely done in different functions), but that's where to start looking at
BTW, your stripped-down version reads:
``` while IFS= read -u 5 -r line; do test_command done < verbs ``` I wonder if you'd rather want: ``` while IFS= read -u5 -r line; do test_command done 5< verbs ``` (maybe it's just a bad cut & paste when stripping down)
2) note: the solution 1) could be fragile if the script isn't run from a unix shell other option is to run 'wine wineconsole cmd...', but that could require moving the redirections for capturing output inside the cmd's scripts which may be quite of work
3) don't depend on chcp success/failure changing 'chcp 65001 > nul && echo %AppData%' into 'chcp 65001 > nul & echo %AppData%) should work
Also note that unicode support wrt. chcp requires some more work (see MR!6885 https://gitlab.winehq.org/wine/wine/-/merge_requests/6885), but that's an orthogonal issue
https://bugs.winehq.org/show_bug.cgi?id=57615
Austin English austinenglish@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution|--- |NOTOURBUG
--- Comment #2 from Austin English austinenglish@gmail.com --- Thanks Eric, I changed it to use '&' to avoid checking the return value for now.
https://bugs.winehq.org/show_bug.cgi?id=57615
Austin English austinenglish@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #3 from Austin English austinenglish@gmail.com --- Fixed in upstream winetricks in https://github.com/Winetricks/winetricks/commit/9ff7f2fa049832169b74dc93d724...