Repository navigation
fix(main): skip a missing startup file silently, report a directory as GNU does (Refs #3457) - #3549
Merged
Merged
Conversation
…s GNU does (Refs #3457) GNU runs every startup file through builtins/evalfile.c:339 maybe_execute_file with FEVAL_ENOENTOK: ENOENT is not diagnosed (evalfile.c:120) and returns 0 (evalfile.c:130); EACCES and other open failures still go through file_error, and a directory is reported as `%s: is a directory` (evalfile.c:133-138). run_init_file diagnosed ENOENT and, on Windows, reported a directory as `Permission denied`. The diagnostic name prefix is untouched (PR #3447 owns it). Also rustfmt the d11 stem (master drift from #3511) so the fmt hook passes. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
caomengxuan666
marked this pull request as ready for review
November 14, 2026 05:06
caomengxuan666
marked this pull request as draft
November 14, 2026 05:09
caomengxuan666
marked this pull request as ready for review
November 16, 2026 12:01
Member
Author
|
【WIN-AGENT-AUDIT】s10 lane 第 4 轮 — 建议:PASS(按 S 波授权已 squash 合入) head: e3d4959 base(merge-base): 8b48c16 文件: 3 个 +148/-6 机制核查:
腿(逐项给数字与名字):
F 点:无 未跑/VOID 的腿:
|
This was referenced Nov 16, 2026
Merged
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.
修了什么
交互 shell 的
--init-file/--rcfile(以及所有走run_init_file的启动文件)读取失败时:rubash: <file>: No such file or directory;现在与 GNU 一样静默跳过,继续启动。Permission denied(Windows 拒绝以读方式打开目录);现在先查文件类型,报 GNU 的<file>: is a directory,继续启动。退出码本来就是 0(
-c串照常执行),不变。删了什么
ENOENT 分支的诊断。
GNU 依据
shell.c:1130-1143execute_bashrc_file →maybe_execute_file (bashrc_file, 1);builtins/evalfile.c:339-345maybe_execute_file 的 flags 为FEVAL_ENOENTOK|FEVAL_RETRY。evalfile.c:120if (((flags & FEVAL_ENOENTOK) == 0) || errno != ENOENT) file_error (filename);—— 只有 ENOENT 静默;evalfile.c:130此时返回 0。evalfile.c:133-138fstat 后S_ISDIR→internal_error ("%s: is a directory")。WSL GNU 5.3.20 实测(
bash --rcfile F -i -c 'echo hi' </dev/null,EACCES 以非特权用户 testu 跑在 /tmp):缺失 → 只有hi、rc 0;目录 →bash: F: is a directory+hi、rc 0;chmod 000 →bash: F: Permission denied+hi、rc 0;非交互(无 -i)一律不读 rc 文件、无诊断。注:issue 正文写「目录形与 chmod 000 形同」(即都静默),GNU 实测并非如此 —— 只有 ENOENT 静默,目录与 EACCES 都诊断;本 PR 按 GNU 实测。
验证
tests/issue3457_init_file_enoent_silent.rs:Windows 上 5 例(缺失 init-file / 缺失 rcfile / 缺失目录下的 rcfile / 目录 rcfile / 存在的 rcfile 对照)+ 1 例#[cfg(unix)]EACCES(特权用户自动跳过)。未修树 1 passed / 4 failed(对照组本就过),修后 5/5。EACCES 例未在本机(Windows)运行 —— owed。version_appends_build_metadata…仅在工作树 dirty 时失败,提交后重建通过。tests/d11_pipeline_squote_carrier_regressions.rs仅 rustfmt(master 上 fix(executor): restore DATA_SQUOTE carrier on pipeline child-argv boundaries #3511 遗留的格式漂移,fmt hook 需要)。Owed
#[cfg(unix)]EACCES 例未在 Linux 上实跑。rubash:字面量)不在本 PR 范围,由 PR fix(main): derive startup diagnostics from argv[0] (#3254) #3447 处理;两 PR 在run_init_file同一处会有小的文本冲突。Fixes #3457