Repository navigation
type: interleave per-operand stdout/stderr in merged streams (Refs #2699) - #3124
Merged
Merged
Conversation
…and builtins Refs #2699 GNU builtins/type.def describe_command runs once per name; in a merged stream the not-found diagnostic for operand N precedes the describe line for operand N+1 (GNU bash 5.3.20 oracle). The shared buffered path emits all stdout before any stderr, losing that order. Pin cells: type / command -V merged interleave (middle-miss, first-miss, two-miss), merged-to-file order, plus separate-stream and comsub controls. Fail-first run against the base build is pending the build slot; expectations were taken from the GNU oracle directly.
#2699) GNU builtins/type.def:175-187 describes one name at a time and reports a miss through builtin_error (builtins/common.c:98-110), which writes stderr unbuffered, so in a merged stream the diagnostic for operand N sits between the describe lines for N-1 and N+1. rubash buffered the two streams into separate Vecs and flushed all of stdout before any stderr. Mechanism fix (not per-builtin patching): add an ordered chunk channel to the shared buffered-output path — both streams' Write handles log each write (fd tag + bytes) into one log in production order, and the route walks the log once under a single redirect application. type / command -v/-V switch to the channel (type's Diag flushes per operand); the pair path is untouched. The fmt-only reflow of the pin file (3f68def) is folded in so the tree stays cargo-fmt clean.
Member
Author
|
收官提交已推送: 本 PR 的关联单号为 #2699。 修法摘要:在 批跑 #3 B10 验证数字(2026-11-10 02:08–02:14 UTC,日志
以上为推送记录,合入与关单口径留队长复核。 |
caomengxuan666
marked this pull request as ready for review
November 10, 2026 04:01
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 #2699
多操作数内建在合并流(
2>&1、同一文件、同一捕获)里的 stdout/stderr 交错丢失:共享缓冲输出路径把两流分别收进两个 Vec、在命令结束时整段先发 stdout 再发 stderr。GNU 按操作数逐个发出(builtins/type.defdescribe_command每名一次、诊断走 unbuffered 的 builtin_error),故type echo nosuchcmd123 ls 2>&1的诊断行应落在两个 describe 行之间(GNU bash 5.3.20 oracle 已验)。修法(机制层,非逐内建打补丁):给共享缓冲路径增加有序 chunk 通道——两个流的
Write句柄把每次写按序记入同一日志(fd 标签 + 字节),路由层在一次重定向应用内按记录序逐 chunk 写出;既有 pair 路径退化为 2-chunk 情形、行为不变。type/command -v/-V改走有序通道(type 的 Diag 改逐名 flush),comsub 的 pair 调用点保持原签名与原语义。本 PR 删除了什么
无删除。本 PR 新增有序 chunk 通道(trap_stack_builtins.rs / redirection.rs 路由推广)并把 type/command describe 入口切换过去;
declare -p与alias的同机制转换因其入口文件正被 #2968(④ Phase 4 草稿 PR)改写,按面核停手、另立残余单待其合入后跟进(见 REPORT)。验证状态
队长复核 FAIL(2026-11-09 ~05:47 UTC):头 eefafc4 不编译,不得合入。
src/executor/type_builtin.rsexecute_command_describe_redirected的 fallback 分支引用已不存在的局部缓冲stdout/stderr(E0425 ×4,:28/:33/:40)。基底该函数开头有let mut stdout = Vec::new(); let mut stderr = Vec::new();,修法提交改成OrderedOutputLog时漏了 fallback 分支仍需的两个 Vec 声明(设计笔记原文明示 fallback 保持 Vec + pair flush 不变)。最小修复:fallback 的let action块前恢复两行声明;修后重跑全部头腿。~/workspace/fix-I3/verify-all.log,129,767 字节,2026-11-09 05:46:59Z):头构建 rc=101;钉头未跑 rc=101;lib 头未跑 rc=101;邻茎 6 茎未跑 rc=101;-D warningsrc=101(同源编译错);cargo fmt --checkrc=0;marker lint rc=0(117 registry consts,265 allowlisted sites);lib 基底 1205 过 / 1 红 / 4 忽略——红仅api::consumer_tests::issue2875_input_procsub_child_runs_as_rubash_shell(基底既有红集,待头编译后作双边对照);GNU 探针与残余探针阻塞(无头二进制)。failfirst.log)——此结论维持有效。净行数(vs 基底 88047f5):4 files changed, +432/−8。