You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
niugit wrapper runs command substitution on commit -m message text (breaks verbatim messages) #3
Bug: the niugit wrapper expands commit -m messages (command substitution on the message)
Discovered today by an agent composing a commit whose message contained backticks and ${(kv)} (zsh-flavored text quoted verbatim from an asset under review): the wrapper executed command substitution on the -m message text, so the first commit failed and backtick content was replaced by executed output.
Repro (any repo):
niugit commit -m 'docs: note `uname -r` and ${HOME} handling'
# observed: backticks/substitutions executed or commit aborted; message bytes not preserved verbatim
GNU git commit -m treats the argument as literal bytes, full stop. A wrapper that re-parses or re-evaluates the message breaks every commit whose message quotes shell syntax — which for THIS project is often (commit messages quoting bash snippets are routine in rubash/niubash).
Expected: pass -m payloads through to real git byte-exactly (append to argv, never re-parse); if the wrapper must inspect messages, do it without evaluation.
Found in: C:/Users/cmx/AppData/Local/Programs/Niubash/winuxcmd/opt/niugit/git.exe (wrapper shipped with the product, 2026-10 build).
We reproduced the report scenario through every layer of the product stack and
could not reproduce command substitution at any binary layer:
layer
commit -m 'docs: note uname -r and ${HOME} handling' (single-quoted)
niubash sh / niu -c / script file
POSIX-correct: single quotes protect backticks, ${}, $()
usr/bin/git.exe (wpm multicall link)
passes message bytes verbatim
opt/niugit/git.exe (launcher)
passes message bytes verbatim
opt/niugit/mingw64/bin/git.exe (real)
passes message bytes verbatim
In every case the stored commit object byte-matches the intended message
(docs: note \uname -r` and ${HOME} handling). None of these components evaluate anything — the launcher is a CreateProcessWforwarder and git never runs a shell over-m`.
What does reproduce the reported symptoms exactly
Double-quoting at the call site — standard POSIX shell semantics, identical
under niu, Git Bash and GNU bash on Linux:
$ git commit -m "docs: note `uname -r` and ${HOME} handling"
niu: line 1: ${(kv)...}: bad substitution # <- first commit FAILS (matches report)
# and in the non-zsh variant the backticks execute:
$ echo "A`uname -s`B"
AMSYS_NT-10.0-19045B # <- backtick content replaced by output
The reported failure ("first commit failed and backtick content was
replaced by executed output") is precisely the double-quoted signature: the
backticks ran, and a zsh-flavored ${(...)} raised bad substitution. The
tooling that composed the original commit almost certainly interpolated the
message into a double-quoted command string. -F <file> "working" is
consistent with this: it sidesteps shell quoting entirely.
Recommendation: re-scope this issue to "agent tooling must compose -m
payloads as single-quoted argv elements (or use -F)"; the wrapper itself is
byte-transparent for message text.
Real wrapper-side message-fidelity defects found during the audit
While differential-testing the stack we found two actual wrapper defects
that DO rewrite messages silently (filed separately, release-blocking fixes
proposed):
Closing per the full-stack differential audit (see evidence comment above): the wrapper never performs command substitution - single-quoted messages survive all four layers byte-exactly. The original symptom was caller-side double quoting (POSIX shell semantics, identical in GNU bash). Agent tooling guideline: single-quote -m payloads or use -F. The REAL wrapper defects found by the audit are #4/#5, fixed by #6.
Activity
caomengxuan666 commentedon Oct 12, 2026
Root-cause analysis (full-stack differential audit)
We reproduced the report scenario through every layer of the product stack and
could not reproduce command substitution at any binary layer:
commit -m 'docs: noteuname -rand ${HOME} handling'(single-quoted)sh/niu -c/ script file${},$()usr/bin/git.exe(wpm multicall link)opt/niugit/git.exe(launcher)opt/niugit/mingw64/bin/git.exe(real)In every case the stored commit object byte-matches the intended message
(
docs: note \uname -r` and ${HOME} handling). None of these components evaluate anything — the launcher is aCreateProcessWforwarder and git never runs a shell over-m`.What does reproduce the reported symptoms exactly
Double-quoting at the call site — standard POSIX shell semantics, identical
under niu, Git Bash and GNU bash on Linux:
The reported failure ("first commit failed and backtick content was
replaced by executed output") is precisely the double-quoted signature: the
backticks ran, and a zsh-flavored
${(...)}raisedbad substitution. Thetooling that composed the original commit almost certainly interpolated the
message into a double-quoted command string.
-F <file>"working" isconsistent with this: it sidesteps shell quoting entirely.
Recommendation: re-scope this issue to "agent tooling must compose
-mpayloads as single-quoted argv elements (or use
-F)"; the wrapper itself isbyte-transparent for message text.
Real wrapper-side message-fidelity defects found during the audit
While differential-testing the stack we found two actual wrapper defects
that DO rewrite messages silently (filed separately, release-blocking fixes
proposed):
"losethe quotes, messages ending in
\get corrupted, commits can be aborted;trailing-backslash path args fail hard (
git add 'D:\dir\').commit -m /cstoresc:/.Fixes for both are coming on a branch near you.
fix(wrapper): MSVCRT-correct argv quoting + message-arg conversion gu…
caomengxuan666 commentedon Oct 12, 2026
Closing per the full-stack differential audit (see evidence comment above): the wrapper never performs command substitution - single-quoted messages survive all four layers byte-exactly. The original symptom was caller-side double quoting (POSIX shell semantics, identical in GNU bash). Agent tooling guideline: single-quote
-mpayloads or use-F. The REAL wrapper defects found by the audit are #4/#5, fixed by #6.v2.55.0.5: static git + system_prefix self-locate (wpm flat layout) (#9)
ci: run the launcher differential suite on the x64 build