msys2 / msys2/msys2-runtime

POSIX MSYS2 runtime strips {} from arguments when launching processes with CreateProcess

Open
#332 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
240
Forks
60
Avg merge
2d 3h
Merged PRs (30d)
1

Description

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:

  1. Build wrapper in MINGW64.
  2. Build echo2 in both MINGW64 and MSYS2 POSIX.
  3. 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

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked README.md reproduction and inspect wrapper.c and echo2.c to compare argument handling for MINGW64 and MSYS2 POSIX targets. Run the documented commands with arguments containing {} and trace the POSIX runtime path before CreateProcess; done means the MSYS2 POSIX target receives all arguments unchanged, matching the direct and MINGW64 results.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.