https://bugs.winehq.org/show_bug.cgi?id=57809
Bug ID: 57809 Summary: cmd: Incorrect substring expansion of last character (e.g. `!MY_STR:~1!`) Product: Wine Version: 10.0 Hardware: x86-64 OS: Linux Status: UNCONFIRMED Severity: major Priority: P2 Component: cmd Assignee: wine-bugs@winehq.org Reporter: Dominik-Home@gmx.de Distribution: ---
Call the following script and observe the different output on Windows and Wine. Substring expansion seems to work in general except the last character, therefore MY_STR is set to 1 character to trigger the issue immediately.
Note that I've focused on the issue at hand and haven't tried out other variations of substring-expansion.
issue_substring_expansion.bat ```cmd @echo off
setlocal enableextensions enabledelayedexpansion
set MY_STR=R echo "!MY_STR:~1!" REM Prints "" on Windows REM Prints "R" on Wine ```
This issue is blocking to get PlanAhead (part of Xilinx ISE 14.7) to work. Multiple batch scripts set-up the environment before starting the GUI. Because of this issue, they end up in an endless loop while iterating over all characters in a variable similar to PATH.
My version:
```console $ wine --version wine-10.0 (Staging) ```
https://bugs.winehq.org/show_bug.cgi?id=57809
--- Comment #1 from Dominik-Home@gmx.de --- Created attachment 78028 --> https://bugs.winehq.org/attachment.cgi?id=78028 0001-Fix-57809.patch
Fixes the incorrect sub-string expansion but haven't checked if this has unintended side effects.
https://bugs.winehq.org/show_bug.cgi?id=57809
Eric Pouech eric.pouech@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |eric.pouech@gmail.com
--- Comment #2 from Eric Pouech eric.pouech@gmail.com --- submitted https://gitlab.winehq.org/wine/wine/-/merge_requests/7301 that shall fix this issue (among other things) (same fix as what's in #2, but includes also handling the error cases in parsing
https://bugs.winehq.org/show_bug.cgi?id=57809
Eric Pouech eric.pouech@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |FIXED Status|UNCONFIRMED |RESOLVED Fixed by SHA1| |28b3a2d688594442b992c31593f | |ab068191a507e
--- Comment #3 from Eric Pouech eric.pouech@gmail.com --- resolved fixed
https://bugs.winehq.org/show_bug.cgi?id=57809
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #4 from Alexandre Julliard julliard@winehq.org --- Closing bugs fixed in 10.2.
https://bugs.winehq.org/show_bug.cgi?id=57809
--- Comment #5 from Dominik-Home@gmx.de --- I'm confirming the fix in 10.2. Thank you very much!