Repository navigation
fix(glob,redirect): globstar symlink forms (#1671, #1672) + extglob ambiguous redirect (#1673) - #1764
Merged
Merged
Conversation
…ect checks (rubash#1673)
pathexp.c unquoted_glob_pattern_p counts an unquoted +, @ or ! followed by ( as a glob introducer when extended_glob is set; redirect_target_is_ambiguous only knew $, `, {, *, ?, [, so > @(a.txt|b.txt) with several matches was joined into one space-separated literal filename and written with rc=0 instead of failing with ambiguous redirect. Pass the extglob state from both call sites (expand_word.rs, redirection.rs).
Regression: tests/issue1673_extglob_redirect_ambiguous_regressions.rs
…efixes (rubash#1672) glob.c glob_filename skips a symlinked directory enumerated by ** only when the directory part consists solely of ** segments (all_starstar). With any literal prefix (./, sub/, absolute) the remaining pattern is applied inside the linked directory one level; the ** enumeration itself still never descends into the link. collect_globstar_matches now takes follow_symlink_suffix (set from a non-empty literal prefix) and applies a non-empty suffix to the linked directory's direct entries. Regression: tests/issue1672_globstar_prefix_symlink_traversal_regressions.rs
…ments (rubash#1671) collect_multi_globstar_paths pushed every symlink child of a ** enumeration as a final match even when pattern segments remained, appending every cwd symlink name (dangling included) to **/deep/* and friends. Per glob.c's all_starstar special case, the link itself is a match only when ** is the final segment; with segments remaining and an all-** directory part the link contributes nothing; with a literal or absolute prefix the remaining segments are applied inside the linked directory (one segment consumed, the enumeration itself never descends). Regression: tests/issue1671_globstar_symlink_bare_names_regressions.rs
caomengxuan666
force-pushed
the
fix8/glob
branch
from
October 26, 2026 09:02
06d6355 to
4a68899
Compare
caomengxuan666
marked this pull request as ready for review
October 26, 2026 09:03
This was referenced Oct 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1671
Fixes #1672
Fixes #1673
根因
**/<literal>/…appends bare names of all cwd symlinks to the result #1671 / [bug] globstar./**does not traverse symlinked directories (plain**form agrees with GNU) #1672(同源):GNUlib/glob/glob.cglob_filename的 all_starstar 特判——**枚举出的 symlink 目录,仅当目录部分全由**段构成时才跳过(有剩余段)或自成结果(无剩余段);带字面/绝对前缀时,剩余 pattern 在链目录内应用一层,枚举本身永不深入。rubash 的 multi 收集器无条件吐裸链名([bug] globstar**/<literal>/…appends bare names of all cwd symlinks to the result #1671,连**/nomatch/*都吐三个裸名);单**walk 对 symlink 一律不应用 suffix([bug] globstar./**does not traverse symlinked directories (plain**form agrees with GNU) #1672,./、sub/、绝对、d1/../四形态穿链命中全缺)。pathexp.cunquoted_glob_pattern_p的 extglob 引入符类(未引用的+/@/!后跟()不在重定向歧义门的引入符集合内,@(a.txt|b.txt)的多匹配被空格拼成字面文件名写入、rc=0;补全谓词定义并从两个调用点传入 extglob 状态。集成与验证
160e7928(簇基线2157a3af之后 33 个 commit 零触碰本片四个文件,零冲突;四文件与簇内verified-tree/的 md5 逐一相同,修法形状未动)。cargo test --lib全量同集门(集成方补跑,簇内四度入队未出槽):771 passed / 1 failed / 1 ignored(口径--skip login_posix_env),唯一失败 =ownership_unary_operators_check_existing_file,与 master 基线同集。GitHub CI 的三个红 job 是 master 存量(macOS kill 常量 / Windows goldens lane / darwin cross-target),与本片无关,按主会话口径以本地门合并。