Repository navigation
test: cfg-gate unix-only helper in issue2272 pin stem (Refs #3513) - #3525
Conversation
The helper is only called from a #[cfg(unix)] test, so on Windows it is dead code under RUSTFLAGS="-D warnings". Gate the function and its now-unused Stdio import with #[cfg(unix)] (same mechanism as PR #3508). No test logic changed; unix side compiles identically.
队长复核 PASS结论:合入。 Refs-only,合入后队长手关 #3513。同批五支 test-hygiene 单(#3518/#3519/#3520/#3523/#3524)已合,本支为最后一支。 Diff(已核对原文): 1 文件 +4/−1, 腿(
CI(run 43545588218,失败日志与全量日志原文已核): 3 红 job(GNU 1350/1/4、macOS 1243/1/4、Linux Rust tests 0/1)唯一失败名均为 交集: merge-base 删除节: 正文已有(什么都没删除:2 行 |
根因
tests/issue2272_fdvar_spawn_delivery_regressions.rs中fn rubash_in_stdin_file(:60)无 cfg 门控,其唯一调用点(:290)落在#[cfg(unix)]测试issue2272_fdvar_dup_input_from_ambient_stdin内。Windows 下该测试被编译掉,函数变死代码,RUSTFLAGS="-D warnings" cargo check --tests报 1 项 dead-code(PR #3508 复核轮在 master5219be90上核实)。另:
use std::process::{Command, Stdio};中的Stdio只在该函数内使用(:70.stdin(Stdio::from(file)));只门控函数会让Stdio变成未用导入,在-D warnings下仍报错。故同机制连Stdio导入一并门控(#3508/#3512 先例:use 行随被门控项一并门控)。Command仍被未门控的rubash_in使用,不动。修法
仅
tests/issue2272_fdvar_spawn_delivery_regressions.rs一文件,4 行新增、1 行删除(净 +3 行):#[cfg(unix)]× 2。纯测试改动,不动产品代码、不改测试语义、不碰src/lexer/continuation.rs与docs/api-ledger.md。unix 下编译内容与 base 同义。GNU 锚点:不适用。本单是测试 harness 的 cfg 缺陷,不是 shell 语义分歧;pin 本身及其期望行为在 unix 下完全不变(pin 的语义锚点见文件头注释:redir.c:237 do_redirections、redir.c:1010/:1113 redir_varassign)。
验证(base = master 2acdfc4)
Windows 腿(X299-2607,cargo/rustc 1.99.1,cl 19.44.35230):
RUSTFLAGS="-D warnings" cargo test --locked -j 4 --test issue2272_fdvar_spawn_delivery_regressions --no-run:rc=101,40s,恰好 1 项 dead-code(error: function 'rubash_in_stdin_file' is never used),与 issue 计数一致。注:首轮直连 github.com clone 两次被 reset(curl 56 / early EOF),改走 gh-proxy 镜像后 clone 成功,checkout 钉死2acdfc41核验通过。RUSTFLAGS="-D warnings" cargo test --locked -j 4 --test issue2272_fdvar_spawn_delivery_regressions:rc=0,40s,ERROR_LINES=0,WARNING_LINES=0;running 21 tests,test result: ok. 21 passed; 0 failed(3 个 unix 测试在 Windows 下正确编译掉)。RUSTFLAGS="-D warnings" cargo check --locked --lib --bins -j 4:rc=0,20s,0 error / 0 warning。rustfmt --edition 2021 --check该文件:rc=0。Linux 腿(欠腿,见下):Simular box 盘 100% 满(仅 90M 可用,MemAvailable 仅 220M),按规则不走 box;老服务器
~/oldsrv60s 超时无回显(banner 失联,与 #3512 同日形态)。修法在 unix 下是 no-op(#[cfg(unix)]为真,编译内容与 base 同义,测试体未动),跑测风险低,但按纪律如实记录:Linux 24 测待队长在空闲机器上补跑。CI(run 43545588218)
3 腿红均为同一单测
api::consumer_tests::issue2875_input_procsub_child_runs_as_rubash_shell(Rust tests、Rust tests (macOS)、GNU regression goldens and canaries;其余腿全绿,含 Windows tests compile check、Cross-target check、API ledger tripwire)。与本单无关:本单只动 issue2272 测试文件,失败日志中无 issue2272 字样;该 #2875 红为已知的 lib-only-run NOBIN 陷阱(VOID 证据,#2875 另有在飞车道)。本 PR 删除了什么
什么都没删除。本 PR 只有 2 行
#[cfg(unix)]新增 + 1 行 use 拆行(净 +3 行),0 行语义改动。UNVERIFIED-BY-CAPTAIN