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) ```