Repository navigation
Description
Existing issues matching what you're seeing
- I was not able to find an open or closed issue matching what I'm seeing
I searched open and closed issues for "truncated", "8186", "command line", "noglob" and "backslash". The closest are #561 and #1019 (both closed): the same code path (the runtime's glob step for command lines from non-MSYS parents) with different symptoms.
Git for Windows version
git version 2.55.0.windows.3
cpu: x86_64
built from commit: 52ca1113d651127f89477a8763f86ab20f645e1d
MSYS runtime (uname -a, host name removed): MSYS_NT-10.0-19045 3.6.9-b4195d69.x86_64 2026-06-06 17:49 UTC x86_64 Msys. The newest release is 2.56.0.windows.3, which I have not run; the code on main of git-for-windows/msys2-runtime (read 2026-10-25) has the same logic.
Windows version
Windows 10, 10.0.19045.7663, x86_64.
Options set during installation
Not relevant: it reproduces by starting usr\bin\echo.exe directly.
Terminal/shell
PowerShell 7.6.7, and Python 3.14 subprocess.run: any parent that is not an MSYS program.
Commands that trigger the issue
$e = 'C:\Program Files\Git\usr\bin\echo.exe'; $a = 'e ' * 5000
(& $e $a).Length # 8186, expected 10000
$env:MSYS = 'noglob'
(& $e $a).Length # 10000import subprocess
ECHO = "C:/Program Files/Git/usr/bin/echo.exe"
arg = "ab " * 3999 + "ab" # 11,999 characters
out = subprocess.run([ECHO, arg], capture_output=True).stdout
print(len(out.decode().rstrip())) # 8186, expected 11999
BASH = "C:/Program Files/Git/bin/bash.exe"
script = "wc -c <<'EOF'\n" + "x" * 8256 + "\nEOF\necho TAIL" # 8,284 characters
r = subprocess.run([BASH, "-c", script], capture_output=True)
print(r.returncode, r.stdout) # 0 b'8173\n'; expected 0 b'8257\nTAIL\n'
print(r.stderr) # only bash's here-document warningExpected behaviour
The argument arrives whole (a Windows command line can hold 32,767 characters), or the runtime fails loudly.
Actual behaviour
The argument is cut at exactly 8,186 characters, with no error. echo.exe given 8,185 / 8,186 / 8,187 / 10,000 / 20,000 characters prints 8,185 / 8,186 / 8,186 / 8,186 / 8,186. By kind of argument:
| argument | arrives |
|---|---|
| quoted (it holds a space or a double quote), no glob characters | cut at 8,186 |
| unquoted, no glob characters | whole (20,000 tested) |
unquoted word holding * |
cut at 8,186 |
any of the above with MSYS=noglob |
whole |
For shells this means bash.exe -c "<script>" from a non-MSYS parent loses everything after the 8,186th character of the script. A script cut inside a quote usually fails with unexpected EOF, but a script cut inside a heredoc body runs: exit code 0, the rest of the body and the commands after it silently missing, and only a warning on stderr (second example above).
Other interesting things
The cut is in the glob step that quoted words and words with glob characters go through (build_argv and globify in winsup/cygwin/dcrt0.cc), not in bash or in the Git launcher. A source lead, not a diagnosis: globify calls glob(pattern, GLOB_TILDE | GLOB_NOCHECK | GLOB_BRACE | GLOB_QUOTE, ...), and glob() (newlib/libc/posix/glob.c) copies the pattern into Char patbuf[MAXPATHLEN] and stops at the end of the buffer without reporting it. I did not trace why the observed limit is 8,186 and not PATH_MAX (4,096 in the limits.h I read). The same code is in MSYS2 and Cygwin; I have not tested those.
Seen in the wild: Claude Code's Bash tool on Windows starts bash.exe -c "<its wrapper and the command>", so any command longer than about 7,700 characters is cut (anthropics/claude-code#102533, #92543, #93915).
Activity
rimrul commentedon Oct 26, 2026
The Cygwin team has known about this since at least 2014.