Skip to content

[linux] glob: escaped-star patterns leak the backslash-star into the result (a\*b -> 'a\*b*', 'a*b/ooo' -> 'a*b/*') #236

Closed

Description

@caomengxuan666

Linux build (wt4/linuxrun), true-baseline glob.tests run vs GNU 5.3.0 (beyond the ordering issue in #235, glob.tests shows these membership/text diffs).

Evidence (target/issue-suites/results/true-baseline/glob/{gnu.out,rb.out} around lines 117-199):

 GNU: a\*b          RUB: a\*b*        (extra trailing star; pattern with escaped star)
 GNU: a\*b*         RUB: a\*b*        (matches)
 GNU: argv[1] = <a*b/ooo>   RUB: argv[1] = <a*b/*>   (quoted star inside path pattern)
 GNU: argv[1] = <a*b/ooo>   RUB: argv[1] = <a*?/*>

I.e. when a glob pattern contains an escaped/quoted * and the match fails or partially matches, rubash returns the literal pattern text with backslashes stripped or stars re-expanded, where GNU either matches the exact literal path (a*b/ooo) or prints "no match".

Owning anchors to read before fixing: lib/glob/glob.c glob_pattern_p / glob_vector quoting state, parse.y:5305 read_token_word for how quoted metacharacters are carried (CTLESC protection parse.y:5694-5706), and rubash's carrier-byte handling for quoted glob chars in src/executor/glob.rs. Marked unverified beyond the diff evidence - the fixture for these lines (files named a*b, dir a*b) is created by glob.tests itself.

Artifacts: see above; ledger glob 40 (subset).

Activity

  1. added
    bug
    gnu-baseline
    on Sep 27, 2026
  2. caomengxuan666 commented on Sep 27, 2026

    @caomengxuan666
    MemberAuthor

    证据裁定为环境绑定,予以关闭:#236=Win32 无法创建通配符命名文件(GNU-on-drvfs 靠 PUA 编码落盘 U+F02A;条目经 MSYS/WSL 工具创建后 rubash 全转义星矩阵与 GNU 字节一致,工件 target/issue-suites/results/misc2-lane/glob236/);#238=read -t 1 </dev/tty 仅在 harness 会话分歧(/dev/tty 设备假象;直探与 timeout 包裹两壳均 estat=142 一致)。感谢报告!

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

    buggnu-baseline

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions