Skip to content

[completion] compgen -d -- "~/" 带引号 tilde-slash 不展开返回空(GNU 正常列出;同构建不带引号正常) #523

Closed

Description

@caomengxuan666

复现

compgen -d -- "~/" | sort
stdout rc
GNU bash 5.3.0(WSL) ~/.cache、~/.config… 全量 ~ 下目录列表 0
rubash 764b9dd (空) 0

隔离(排除 HOME 差异因素)

同一 rubash 构建:

compgen -d -- ~/      → 正常列出 $HOME 下目录 ✔
compgen -d -- "~/"    → 空 ✘

→ 精确定位:带引号的 tilde-slash 前缀不展开,补全词通道把引号词当作字面前缀。补全 UI 场景(readline 词天然带引号属性)高频命中。

规范/源码依据

  • bash 手册(Programmable Completion,compgen):compgen 按 completion 词的规则对待 word——tilde 展开(含带引号形式)是补全词生成的固定步骤。
  • GNU 实测:compgen -d -- "~/" 等价于 compgen -d -- ~/。

跨实现互证(huck)

证据

  • 语料出处:cd_completion_diff_check.sh:19(F136,label: compgen -d quoted ~/,huck 语料分类 product/补全)
  • 复核:764b9dde 仍复现;旧构建 41de831 行为一致

Activity

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

    @caomengxuan666
    MemberAuthor

    Fixed by #576 (Wave4a). Vendored-bash anchors and RED-then-GREEN regression evidence in the PR.

  3. added 2 commits that reference this issue on Nov 2, 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

    P2-mediumbug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions