Skip to content

__git_ps1 分离头描述值泄漏载体字节 U+0010 与引号(t9903 六例) #3005

Closed

Description

@caomengxuan666

现象

git-prompt t9903-bash-prompt 六例在 rubash 下独败(#6/#7/#8/#9/#10/#49),全为分离头(detached HEAD)渲染:__git_ps1 的分离描述值泄漏字面 U+0010 载体字节 + 一对双引号。附着分支名渲染全过。

最小复现

任意两提交仓,git checkout HEAD^ 分离,source 钉版 git-prompt.sh(v2.43.0)后调 __git_ps1:

  • GNU: ((cf11453...));describe 风格: ((t2))、 ((tags/t2))。
  • rubash: (( + U+0010 + "cf11453..." + "));风格形如 ((\x10"t2"))、 ((\x10"tags/t2"))。

构造点

git-prompt.sh:487–505——分离时 b="$(case $GIT_PS1_DESCRIBE_STYLE in … git describe … esac 2>/dev/null)",失败回退 b="$short_sha..."。两条来路(describe 命令替换捕获、short_sha 回退)在 rubash 下都带泄漏;附着路径 b="${head#ref:}" 干净。故根在命令替换捕获值的解码面,非 prompt 脚本本身。

泄漏字节形(载体 + 引号)与 #2879 普查的「缺解码/外泄」族同形,修复时互引、按载体协议定根。

证据

生态链报告 ~/workspace/eco-2904/REPORT.md §4 D3(t9903 rubash 61/6/0 vs GNU 67/0/0,独败仅本面六例)。修复须带以本单号命名的回归钉。

归宿:Stage 3 生态链波 / 自动派活队列。

Activity

  1. added
    bug
    gnu-baseline
    area:carrier
    on Nov 7, 2026
  2. caomengxuan666 commented on Nov 7, 2026

    @caomengxuan666
    MemberAuthor

    队长补充证据(2026-11-08):本单正文称根在命令替换捕获值的解码面——经隔离探针证伪。b="$(echo v1.0)" 单独捕获在 rubash 下干净(76 31 2e 30),$short 回退亦干净;只有随后 b="($b)" 的赋值包裹泄漏(28 10 22 76 31 2e 30 22 29),与本单症状字节一致。根在赋值路径的 marker 解码缺口,已另立 #3034(y="($x)" 最小形,队长在 master 上复现);待该单修复验证(钉 + __git_ps1 分离链重跑)后,本单随之关闭。本单此前无人动工,根因结论以此为准。

  3. caomengxuan666 commented on Nov 8, 2026

    @caomengxuan666
    MemberAuthor

    Closed as a consequence of merged PR #3056 (squash merge 873b30e6, 2026-11-08), which fixed this issue's root cause #3034.

    This issue's own body root-cause claim was falsified during the eco-2907 investigation: the real root was #3034 — the compound-expansion functions claimed any paren-shaped value (including this issue's detached b="($b)" chain shape from __git_ps1) as an element list and stored the transport product raw.

    Captain verification on PR #3056 (head fd6e13e5, true base 30ddc122) included this issue's exact chain shape as a differential probe: b="$(printf v1.0)"; b="($b)" now produces byte-identical output to GNU bash 5.3.20, and the PR's regression stem carries a git_ps1_detached_chain_3005 cell (passes on head, fails on base).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

area:carrierbuggnu-baseline

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions