Repository navigation
test: add fail-first regression pins for empty hash -p path (Refs #3824) - #3829
Merged
Merged
Conversation
GNU anchors: hashcmd.c phash_search (RELPATH arm) + findcmd.c:214-223 executable_file (FS_EXECABLE and not a directory). The stored empty path must read back as "", and running it must fail ": No such file or directory" (rc 127), not "./: Is a directory" (rc 126). UNVERIFIED-BY-CAPTAIN
…efs #3824) GNU findcmd.c:214-223 executable_file requires FS_EXECABLE and not a directory; the unix is_executable_file was a bare access(X_OK), which admits directories (search permission). That made phash_search_spelling return "./" for a stored empty hash -p path: hash -t printed "./" and running the entry failed "./: Is a directory" (rc 126) instead of GNU's ": No such file or directory" (rc 127). Shared fix commit for #3825 (same commit cherry-picked onto the #3825 branch): the #3825 hash/type post-checks call this predicate. UNVERIFIED-BY-CAPTAIN
Formatting only (server rustfmt --edition 2021); no semantic change.
Member
Author
|
PR #3829 第1轮 — 建议:PASS(附一处正文表述偏差与爆炸半径说明,均不阻塞) 机制核查:
腿(逐项给数字与名字):
F 点:无 续作记录:无(只审未改) 未跑/VOID 的腿:无 |
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.
摘要
hash -p '' ghost之后hash -t ghost应印空路径、运行该条目应报: No such file or directory(rc 127);当前 rubash 印./、运行报./: Is a directory(rc 126)。修法已落盘:
53acd684(src/executor/path.rs1 处)。回归钉7c16f5b4(8 cells)+ 格式修复eeae7b85。根因
hash -p的插入本身正确(存"")。分歧在读路径phash_search_spelling(src/builtins/hash.rs:488-530):它对相对路径条目加"./"前缀再测is_executable_file("./")。unix 侧is_executable_file(src/executor/path.rs:3944)是裸access(X_OK),目录因搜索权限而通过,于是返回Some("./")。GNU 的同名原语不接受目录。
GNU 锚点
hashcmd.cphash_search:RELPATH 条目加"./"后以executable_file判定。findcmd.c:214-223executable_file:(s & FS_EXECABLE) && ((s & FS_DIRECTORY) == 0)。hash.def:163-180add_hashed_command:-p插入只拒目录(.//),存原值。修法
unix 侧
is_executable_file改为!path.is_dir() && file_is_executable(path),与 GNUexecutable_file对齐;其 src 内唯一调用点即hash.rs:501。Windows 侧已是is_file(),不受影响。私有file_is_executable(裸 access)未动:它同时是 PATH 查找的执行臂,目录在 PATH 中的处理是另一未立案的执行面(见 REPORT §8),不在本单范围。本 PR 删除了什么
无删除(新增回归钉
tests/issue3824_hash_empty_p_path.rs,8 个 cells)。验证(车道腿,UNVERIFIED-BY-CAPTAIN)
hash -t、运行 rc127、双空-p),5 个对照全过。type_a_empty_path_element_visit_counts,[bug] type -a reports the cwd match once per empty PATH element; GNU collapses adjacent empty elements #2943)在本 PR(diff 到不了它)上同样红,属基线/抖动。-D warningscheck 0、lib 双边 1368/1/4 两侧完全一致(唯一红 cell 为已知 Windows 基线 issue2084)、hygiene 三项全 0;钉 stems 为 unix-gated,Windows 上 0 tests。