When a program built with the MSYS2 POSIX runtime is launched via CreateProcess, any arguments containing {} are stripped before reaching the child process. Programs built with MSYS2/MINGW64 runtime preserve the arguments as expected.
A minimal repro is included in https://github.com/ikappaki/issue-msys2-createprocess.
- wrapper.c — launches a target executable and forwards arguments.
- echo2.c — prints received arguments.
Steps to reproduce:
Follow README.md instructions:
- Build
wrapper in MINGW64.
- Build
echo2 in both MINGW64 and MSYS2 POSIX.
- Run the wrapper with
echo2 and arguments containing {}.
Running the programs directly preserves {}:
$ ./echo2.x86_64.exe 1 {2} 3
1 {2} 3
$ ./echo2.msys2.exe 1 {2} 3
1 {2} 3
Launching via wrapper triggers the POSIX runtime issue:
# OK (MINGW64 target)
./wrapper.x86_64.exe ./echo2.x86_64.exe 1 {2} 3
# Executing: "./echo2.x86_64.exe" 1 {2} 3
# 1 {2} 3
# ISSUE (MSYS2 POSIX target)
./wrapper.x86_64.exe ./echo2.msys2.exe 1 {2} 3
# Executing: "./echo2.msys2.exe" 1 {2} 3
# 1 2 3
The second argument loses the {} when using the MSYS2 POSIX runtime.
Same behaviour occurs with /usr/bin/echo
$ ./wrapper.x86_64.exe /usr/bin/echo 1 {2} 3
# Executing: "D:/msys64/usr/bin/echo" 1 {2} 3
# 1 2 3
Expected behavior:
All arguments, including {}, are passed unchanged.
Actual behavior (POSIX runtime):
Curly braces are stripped from the arguments.
Notes:
- Only occurs with MSYS2 POSIX executables.
- Likely related to argument conversion in the POSIX layer before
CreateProcess.
- Impacts CLI tools or scripts that rely on
{} in arguments, such as invoking git from a process like git --git-dir C:\abc rev-parse 12345678abcde^{commit}.
Thanks
When a program built with the MSYS2 POSIX runtime is launched via
CreateProcess, any arguments containing{}are stripped before reaching the child process. Programs built with MSYS2/MINGW64 runtime preserve the arguments as expected.A minimal repro is included in https://github.com/ikappaki/issue-msys2-createprocess.
Steps to reproduce:
Follow README.md instructions:
wrapperin MINGW64.echo2in both MINGW64 and MSYS2 POSIX.echo2and arguments containing{}.Running the programs directly preserves
{}:$ ./echo2.x86_64.exe 1 {2} 3 1 {2} 3 $ ./echo2.msys2.exe 1 {2} 3 1 {2} 3Launching via
wrappertriggers the POSIX runtime issue:The second argument loses the {} when using the MSYS2 POSIX runtime.
Same behaviour occurs with /usr/bin/echo
$ ./wrapper.x86_64.exe /usr/bin/echo 1 {2} 3 # Executing: "D:/msys64/usr/bin/echo" 1 {2} 3 # 1 2 3Expected behavior:
All arguments, including
{}, are passed unchanged.Actual behavior (POSIX runtime):
Curly braces are stripped from the arguments.
Notes:
CreateProcess.{}in arguments, such as invoking git from a process likegit --git-dir C:\abc rev-parse 12345678abcde^{commit}.Thanks