Skip to content

git.exe 启动器丢弃 argv 中的双引号、破坏尾部反斜杠(commit -m 消息字节损坏) #7

Closed

Description

@caomengxuan666

opt/niugit/git.exe 启动器重建命令行时丢弃 argv 中的 "、破坏尾部 \ —— verbatim 保真违规

来源:rubash 仓边界契约审计(unixwin/rubash branch docs/boundary-contract-audit,不变量 C:commit -m 消息字节保真)。调用方(rubash / Git Bash)的引用已被逐一排除——损坏发生在 stub 重建子进程命令行处。

复现(安装树 opt/niugit/git.exe,147KB KERNEL32-only 启动器;真 git 在 opt/niugit/mingw64/bin/git.exe)

GIT_STUB=C:/Users/cmx/AppData/Local/Programs/Niubash/winuxcmd/opt/niugit/git.exe
GIT_REAL=C:/Users/cmx/AppData/Local/Programs/Niubash/winuxcmd/opt/niugit/mingw64/bin/git.exe

cd $(mktemp -d) && $GIT_STUB init -q .

$GIT_STUB config test.val 'say "dq" ok'
$GIT_STUB config test.val          # -> say dq ok          (双引号丢失)

$GIT_STUB config test.val 'trailing backslash \'
$GIT_STUB config test.val          # -> trailing backslash "   (尾部 \ 被改写成 " + 空格)

$GIT_STUB config test.val 'mix "q" and \ and $X'
$GIT_STUB config test.val          # -> mix q and \ and $X     ($X 保真、\ 保真、仅 " 丢失)

commit -m 同型:git commit -m 'fix: keep $HOME and "dq" literal' 入库后变成 fix: keep $HOME and dq literal。

排除调用方

  • 同一消息经 rubash(native 子进程 argv 路径)传给 rubash 子进程:字节逐位保真(rubash 的 Windows 命令行引用遵循 CommandLineToArgvW 规则)。
  • 同一消息直接调 GIT_REAL:保真(say "dq" ok 原样入库)。
  • 只有经 stub 转发时丢失 → stub 拼接子命令行时对 "/尾部 \ 的转义不正确。

影响

  • commit -m 消息字节损坏(审计不变量 C 的正测试形态);任何含 " 的参数——消息、路径、remote URL、-c key="value"——经 stub 后被静默改写。
  • 该 stub 是 winuxcmd 部署的默认 git 入口(任务纪律指定使用 opt/niugit/git.exe),命中面是全部代理/脚本工作流。

修复后请同步 rubash 侧

tests/path_contract_boundary_verbatim.rs 顶部 auditor 注释已指向本 issue。修好后可在该文件补一条"经 stub 的 commit -m 字节保真"正测试(当前刻意只锁 rubash 侧保真)。

Activity

  1. added
    bug
    on Oct 12, 2026
  2. caomengxuan666 commented on Oct 12, 2026

    @caomengxuan666
    MemberAuthor

    Dup of #4 (same root cause: the stub launcher rebuilds the child command line without MSVCRT quoting rules, dropping embedded " and mangling trailing \), fixed by #6 (MSVCRT-correct quoting + differential regression suite in scripts/test-launcher.py). This audit tested the INSTALLED stub at opt/niugit/git.exe, which predates the #6 build - the fixed build passes the identical repro 49/49. Deployment path: next niu-git tag carries #6 (see #4 for the release checklist).

  3. caomengxuan666 commented on Oct 17, 2026

    @caomengxuan666
    MemberAuthor

    Same launcher argv re-quoting/corruption report as #4 (one in English, one in Chinese).

  4. added
    duplicate
    on Oct 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugduplicate

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions