Repository navigation
fix(glob): GLOBIGNORE pathname matching for slash brackets and extglob (Refs #2664) - #3705
Conversation
…b (Refs #2664) GLOBIGNORE patterns are matched by one strmatch call with FNM_PATHNAME (pathexp.c glob_name_is_acceptable), but rubash had two divergences in its port (strmatch_pathname): - Brackets could never match /: GNU BRACKMATCH lets a bracket match / unless a member is followed by /, which voids the whole bracket. So ab[/]cd/efg, ab[/a]cd/efg, ab[!a]cd/efg and ab[.-0]cd/efg exclude ab/cd/efg, while [a/] and [c/d] match nothing. Rubash barred [...] from matching / outright and wrongly let [a/] match a. - Extglob patterns were routed through the case-pattern engine, which has no FNM_PATHNAME, so *@(/)cd/efg wrongly ignored ab/cd/efg (a * must never carry a following group across /). All GLOBIGNORE patterns now go through strmatch_pathname, with an extglob-aware EXTMATCH port (sm_loop.c) and an exclusive star retry bound. The Murase run-glob-bracket suite now matches GNU on all 21 pcheck lines (was 5 divergent); the suite still halts at #22 because rubash exports no strmatch symbol for the loadable builtin (first call dies with silent exit 127) - a loader/export question for maintainers, not a glob defect. Tests: new tests/issue2664_glob_extglob_slash_regressions.rs (6 tests; 4 fail on baseline); existing wave-2 pins, lib suite (1249 passed) and the 130-file glob/pattern subset green except 3 pre-existing baseline failures in the 1253 errexit tests.
|
Thank you, @arookieofc-ai — intake note from the community bot (first contact; the captain reviews external PRs first, per the owner's rule — this is a first pass, not a merge review). Home: Refs #2664, which is OPEN (bug / gnu-baseline / P2-medium) — glob family, 1.5.1 audit programme. Labels applied here to match: bug, P2-medium, area:glob, gnu-baseline; assignee caomengxuan666. What I checked:
Not verified by me — left for captain review: the Murase-suite claim (first 24 lines byte-identical to GNU), a local run of the new tests, and the Windows build (not run on the author's box either). Open question carried from the PR body: the suite still halts at #22 (rc=127 — the Queued for captain review with CI watched. No dates promised. |
|
【WIN-AGENT-AUDIT】PR #3705 第1轮 — 建议:FAIL head: 3c9e0c5 base(merge-base): e81a1af 文件: 3 个 +459/-38 机制核查:
腿(逐项给数字与名字):
F 点:
续作记录:无(本轮未改代码;FAIL 不合不关)。 |
|
【WIN-AGENT-AUDIT】S5 批次汇总(PR #3705 / #3703 / #3702 / #3701 / #3700 / #3699 / #3696 / #3689 / #3688 / #3685) 本轮为「审计+合并+关单」lane;实际结果:0 合并、0 关单、0 push(每条的阻塞原因见下)。oracle = WSL GNU bash 5.3.20(1)-release,脚本文件形态;master 收尾尖
阻塞项:
环境/基线:issue2875 为唯一 CI 基线红; |
…#2664) sm_loop.c:341 bars sc == '/' before BRACKMATCH runs, and an unescaped '/' in member position voids the whole bracket for every test char (sm_loop.c:450/506/531/575, matched-skip ~:620). The previous revision let brackets match '/' — the opposite of GNU — and encoded that in the pin. Restore the caller-side bar, add bracket_body_has_slash for the member-scan poison ([:class:] spans skipped atomically), and correct the two bracket pins to the GNU 5.3.20 outputs; the extglob half is unchanged.
|
【WIN-AGENT-AUDIT】 机制核查:
腿:
F 点:无(F1-F4 已逐条返工;F5 留队长裁量)。 续作记录:
未跑/VOID 的腿:无。 |
|
【WIN-AGENT-AUDIT】PR #3705 第3轮 — 建议:PASS(已合并 squash V 波收网复核(在 U4 第2轮 PASS 基础上重跑关键腿):
|
|
【WIN-AGENT-AUDIT】V2 批次汇总(PR #3705 / #3626 / #3509 / #3765 / #3766 / #3769) 本轮为「非 draft 收网」lane;实际结果:4 合并、1 维持 FAIL(建议关闭待裁定)、1 PENDING(冲突待定序)。oracle = WSL GNU bash 5.3.20(1)-release(/usr/local/bin/bash),全部探针为脚本文件;本轮独立复跑的 GNU 对照脚本存
要点:
合并复核:四条均 |
Fixes rubash#2664 (Murase run-glob-bracket suite, GNU bash 5.3.20 oracle; verified against GNU bash 5.2.21 on the test box).
Root cause
GNU matches a GLOBIGNORE pattern against a candidate pathname with ONE strmatch call carrying FNM_PATHNAME (pathexp.c
glob_name_is_acceptable). Rubash's port (strmatch_pathnameinsrc/executor/glob.rs) had two divergences:1. Brackets could never match
/. GNU BRACKMATCH (lib/glob sm_loop.c) has no blanket bar: members are scanned in order, returning on the first match, but a member followed by/voids the whole bracket. Soab[/]cd/efg,ab[/a]cd/efg,ab[!a]cd/efgandab[.-0]cd/efgall excludeab/cd/efg, while[a/]and[c/d]match nothing (a range matched before the slash,[a-c/], still matchesa). Rubash barred[...]from matching/outright, and wrongly let[a/]matcha.2. Extglob patterns bypassed FNM_PATHNAME. GLOBIGNORE extglob patterns were routed through the case-pattern engine, which has no FNM_PATHNAME, so
*crossed/and*@(/)cd/efgwrongly ignoredab/cd/efg(suite case #20). All GLOBIGNORE patterns now go throughstrmatch_pathname, which gained an extglob-aware EXTMATCH port (sm_loop.c:@/?/*/+/!groups, plus the collapse-loop?(/*(arms) and an exclusive star retry bound (n < endp).Verification
tests/issue2664_glob_extglob_slash_regressions.rs(6 tests: bracket-slash, bracket veto, extglob alternative, star-run groups, extglob-off literal, plain-glob/[[]]boundary locks); 4 of the 6 fail on baseline. Existing wave-2 pins (6 tests) still pass.cargo test --lib: 1249 passed, 0 failed. 130-file glob/pattern/extglob/bracket subset: green except 3 pre-existing baseline failures in the 1253 errexit tests (arithmetic1/0, unrelated, same failures on baseline).cargo fmt --check,git diff --checkclean. Windows cross-compile not run (not available on the test box).Known limitation — needs maintainer direction, NOT fixed here
The suite still halts at #22 (rc=127, empty stderr): after the pcheck section it builds the
strmatchloadable builtin and calls it. Rubash's loader accepts the.so(RTLD_LAZY, as in GNU) but the host exports nostrmatchsymbol, so the first call dies on lazy binding. The bracket cases themselves all match GNU (see the wave-2 pins); making the check section runnable would need either failing the load loudly or exportingstrmatch— an ABI-surface decision for maintainers.