Skip to content

test(issue2793): expand /dev/tcp|udp delivery pins; UDP reply cell locked to GNU byte-wise read (Refs #2793) - #3361

Merged
caomengxuan666 merged 1 commit into
masterfrom
fix/W-2793-devtcp
Nov 11, 2026
Merged

caomengxuan666 merged 1 commit into
masterfrom
fix/W-2793-devtcp

Conversation

@caomengxuan666

Copy link
Copy Markdown
Member

Refs #2793

内容

tests/issue2793_devtcp_external_delivery.rs 扩钉(单文件):茎内原 4 格不动,新增两格,其中一格的期望按 GNU 实测订正。

  • 新增 issue2793_foreign_child_reads_inherited_devtcp_fd3:真外来子进程(python3)直接读继承的 fd 3(非 stdin dup 形),锁 socket fd 按号交付。
  • 新增并订正期望 issue2793_udp_fd_sends_datagram_and_reads_reply:/dev/udp 持久 fd 形(exec 3<> + printf >&3 + read -u 3)。发送方向锁服务端收包逐字一致;回复读回的期望按下节订正。

UDP 格期望的 GNU 出处与定界结论

原期望 line:[pong-udp](整行读回)从未在 GNU 上跑出过。定界探针(GNU bash 5.3.20 oracle,同形脚本文件)实测:UDP 形 rc:142、line:[p];fifo 字节流对照形才整行读回。机制在 GNU 源码:builtins/read.def:736 普通行读路径逐字 zread (fd, &c, 1)——一次 read(2) 只取 1 字节;数据报 socket 上首读整包消费、余字节被内核丢弃,其后读阻塞至 -t 超时,返回已得的 p 与 rc 142。rubash 与 GNU 逐字同形,属钉期望缺陷,产品零改动。本格期望改为实测形(脚本加印 rc:$?,期望 rc:142 + line:[p]),read -t 10 缩为 -t 1(-t 1 形已在 oracle 与 rubash 双边重测,测得值不变,整格约 1s),保留作「数据报逐字节读」回归锁。

性质与口径

  • 本 PR 是该单的 Linux 面回归锁:6 格在 master 尖 f5f65d35 全绿(box 复跑,逐格结果见车道报告续节)。
  • Windows 面不在本 PR 口径:Windows 下编号 fd ≥3 对外来子进程无现行交付通道,属结构边界、另有归宿;该单保持 OPEN。
  • 产品代码零改动。

本 PR 删除了什么

无。

验证

  • box(Simular,主克隆 worktree @ master 尖 + 共享 warm target,flock 串行):整茎 6/6 绿,cargo fmt --check rc=0(数字见车道报告续节)。
  • GNU 对照:oracle 同形探针 -t 5 / -t 1 两测、rubash 同形对照一测,输出逐字一致(rc:142、line:[p])。

Two extension cells for the Linux face: a foreign child
(python3) reading its inherited fd 3 directly, and the
/dev/udp persistent-fd form (exec 3<> + printf >&3 + read -u 3).

The UDP reply expectation is locked to GNU's byte-wise read:
builtins/read.def:736 calls zread (fd, &c, 1) on the plain line
path, so the first 1-byte recv consumes the whole datagram and
the kernel discards the rest; the read then blocks until -t
expires and returns 142 with line holding just "p". GNU bash
5.3.20 oracle measured this shape at -t 5 and -t 1
(rc 142, line:[p]); rubash is byte-identical. The previous
whole-line expectation was never GNU-measured. -t is 1 so the
cell costs ~1s.

Test-only change; the Windows delivery face of the issue is
out of scope for this commit.
@caomengxuan666
caomengxuan666 marked this pull request as ready for review November 11, 2026 13:48
@caomengxuan666
caomengxuan666 merged commit e19f6c1 into master Nov 11, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant