Repository navigation
fix(executor): drain socket fd endpoints through recv in the stdin text channel (Refs #2793) - #3460
Conversation
…xt channel (Refs #2793) A netopen endpoint's File wraps a SOCKET handle, and std File::read_to_end reaches ReadFile, which rejects an overlapped socket with ERROR_INVALID_PARAMETER (rubash#1976) - the stdin text channel declined and the consumer saw an empty stdin. Socket endpoints now drain through crate::fd::read_some (recv) until EOF; every other endpoint keeps the existing shared-offset dup + read_to_end exactly. GNU anchor: redir.c:660 redir_open routes /dev/tcp|udp through netopen (lib/sh/netopen.c:282), which leaves ONE ordinary descriptor - later dup2/inherit treats it like any other descriptor, so a reader of the fd must see the socket bytes, not a ReadFile decline.
结论
CI 全读(头 4608883,run 43273370362,attempt 3 终态 2026-11-12T19:09:29Z)
钉双边(Linux,无回归检查)BLOCKED——未跑。 legs-driver 门控(MemAvailable ≥4000M 且 rustc ≤1)在 60+ 分钟内一次未开(峰值 3522M),驱动三度死于 runtime 重启,复核员 20:41 手动停;无任何 leg 日志落盘。返工后复核必跑:pin-head2 / pin-base / lib2875-head / lib2875-base(后者即 macOS 裁决腿)。 相邻茎 + lib 双边 +
|
|
【WIN-AGENT-AUDIT】 机制核查:
腿(X299 = 本机 Windows 全跑):
F 点:
续作记录:本轮仅验证腿,未改代码未推送(远端 head e817f1f 未变)。 未跑/VOID 的腿:
|
Refs #2793(Windows 面;Linux 面已由 #3361 锁死)。
根因
netopen 端点的
File包的是 SOCKET 句柄;stdFile::read_to_end走ReadFile,对 overlapped socket 报 ERROR_INVALID_PARAMETER(rubash#1976)。
stdin_string_for_command(stdin 文本通道)据此直接 decline,cat <&3的仿真路径于是看到空 stdin。改动只加一个 socket 感知的读端
read_fd_read_endpoint_bytes:Windows 下端点是 socket 时走crate::fd::read_some(recv)循环读到 EOF;其余端点保持原有shared-offset dup +
read_to_end一字不改。部分字节在后继硬错时保留,零字节硬错返回 Err(调用点 decline,与原口径同)。
GNU 锚点
redir_open经 netopen(lib/sh/netopen.c:282)留下一个普通描述符,后续 dup2/inherit 一视同仁——fd 的读者必须看到 socket 字节,
而不是 ReadFile 拒绝。
read内置字节读(builtins/read.def:736zread(fd,&c,1))是 UDP fd 格期望
rc:142 / line:[p]的依据(已由 test(issue2793): expand /dev/tcp|udp delivery pins; UDP reply cell locked to GNU byte-wise read (Refs #2793) #3361 钉锁定)。覆盖范围
issue2793_external_cat_reads_devtcp_fd的仿真路径(Windows 上
cat走进程内仿真,其 stdin 即本通道)。(python3
os.read(3),需 spawn 层句柄交付分支)与两格 UDP(现 master 的 netopen 已是 bind+connect 的实 socket,写侧经 send;
1.5.0 的静默丢包是否已随 Windows: /dev/tcp bidirectional fd face broken — exec 3<>/dev/tcp opens but reads/writes on the fd fail EINVAL, peer sees only EOF (#1026 pin CI-proven red) #1976/[bug] /dev/tcp 对端已关闭时写错误报 EINVAL(GNU 为 EPIPE 语义) #2102 修掉,以 X299 实跑为准)。
tests/issue2793_devtcp_external_delivery.rs6 格(test(issue2793): expand /dev/tcp|udp delivery pins; UDP reply cell locked to GNU byte-wise read (Refs #2793) #3361 已备,本 PR 未改钉文件)。
本 PR 删除了什么
未删除任何公开面、文件、函数或测试。仅改
src/executor/shell_options.rs一文件内读端(+75/−18):新增一个
pub(in crate::executor)helper 并改用它的两处调用点;无行为删除。
UNVERIFIED-BY-CAPTAIN
git commit,本次提交经 GitHub DataAPI(blob→tree→commit→ref)投递;blob SHA 已与本地
git hash-object逐字节核对,compare 已核 1 文件 +75/−18。
cargo fmt --check、-D warnings、钉 stem、lib 双边全待复核/合入轮(X299 Windows 靶 + box Linux 对照)。
~/workspace/fix-2793/REPORT.md。