Repository navigation
fix(builtins): record as-found spelling for explicit hash NAME (Refs #3358) - #3476
Merged
Merged
Conversation
…3358) GNU: builtins/hash.def:223-225 hash_builtin calls find_user_command(w) then phash_insert(w, full_path, dot_found_in_search, 0); findcmd.c sh_makepath builds the as-written <elem>/<name> join. The bare-name branch stored find_user_command's session-cwd-anchored resolution (<cwd>/./mycmd for PATH=.:...); store recorded_resolution_spelling (#2696) instead. Regression pins: tests/issue3358_hash_builtin_relative_path.rs.
caomengxuan666
force-pushed
the
fix/3358-hash-builtin-relative-path
branch
from
November 13, 2026 00:15
6c927d2 to
0e80589
Compare
Member
Author
|
【WIN-AGENT-AUDIT】 机制核查:
腿(逐项给数字与名字):
F 点:无 未跑/VOID 的腿:
|
caomengxuan666
marked this pull request as ready for review
November 15, 2026 02:10
This was referenced Nov 15, 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.
Refs #3358(#2696 的后续:run-once 记录路径已由 PR #3120 修,本单是显式 hash 内建余项)。
根因
显式
hash NAME的裸名分支把find_user_command返回的 session-cwd 锚定路径直接存入 hash 表:PATH=.:时hash mycmd存<cwd>/./mycmd,于是hash -t/hash -l/ barehash全印锚定形。run-once 路径与command -v/type描述路径早已存 as-found 拼写,唯独显式 hash 分支取了锚定形。GNU 锚点
full_path = find_user_command (w); phash_insert (w, full_path, dot_found_in_search, 0)。/+ name;元素.→./mycmd。hash -t mycmd→./mycmd;hash -l→builtin hash -p ./mycmd mycmd;type mycmd→mycmd is hashed (./mycmd)。修复
src/builtins/hash.rs裸名分支改存recorded_resolution_spelling(name, &path, env_vars)(#2696 已有的 helper):as-written join 锚定回 program 时返回该 join,否则回落锚定显示形;绝对元素两形重合,行为不变。只动 hash.rs,未碰 path.rs(在飞 PR #3443 面)与 command_execute.rs(在飞 PR #3449 面)。回归钉:
tests/issue3358_hash_builtin_relative_path.rs(2 tests,复用 #2696 harness;seed 前 3 检查 +type+ 3 个对照全量断言)。本 PR 删除了什么
无删除:纯一行存值改动 + 新增回归钉文件;无公开面、无行为面删除。
UNVERIFIED-BY-CAPTAIN
队长复核前未验证:本轮无构建容量(本地写墙 EDQUOT、box 盘满、老服务器 ssh 未恢复、X299 直连未通),以下腿 OWED 到复核轮——
RUSTFLAGS="-D warnings" cargo check --locked --lib --bins、新钉 stemissue3358_hash_builtin_relative_path(须先--bin rubash)、全量 lib 与 base 逐数对齐。已实测:marker-lint OK、utf8-boundary clean、rustfmt --check OK、GNU 探针通过。另见工作区 REPORT.md §4:显式 hash 后的执行面(post-cd)仍走锚定路径,mirror 同步 + phash_search RELPATH consult 建议另案处理。