You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Special paths: complementary-end opens of pipe endpoints need an appendable byte-channel endpoint kind #2385
Residual class from the #2359 engine special-paths wave (PR #2383, REPORT ~/workspace/fix-2359-dev-paths/REPORT.md). GNU: opening a pipe read end's /proc/self/fd/N in write mode materializes the pipe's other end in the kernel (probes s02, u01, u02 in the wave corpus). rubash materializes procsub streams as in-memory TextInput (fd_table.rs:14, built whole at bind, no appendable channel), inherits stdin as a direction-locked virtual endpoint, and no OutputTarget variant can carry such a write channel; external stages have none at all. Closing this needs a new appendable byte-channel endpoint kind in the fd model — an engine design item, deliberately not hacked into the #2359 wave. Destination: post-1.5.0 engine design wave; when picked up, the s02/u01/u02 probe shapes become its pins.
Activity
caomengxuan666 commentedon Nov 1, 2026
已修复并合入 master(PR #2470,merge
7a664134)。GNU 合同
写模式打开 fd 别名拼写走 redir.c 的
do_redirections对 magic link 的普通open()(redir_open,redir.c:725):HAVE_DEV_FD 构建下把名字附到描述符的流上的是内核而非 bash——管道的情形下,这个附着就是管道的另一端。bash 没有管道专用代码;「物化互补端」是内核对pipe:inode 的 open() 语义。实测面(脚本文件探针):
echo x > /dev/fd/3(fd 3 为管道读端)字节按 FIFO 写序汇入读端所服务的同一流;exec 4> /dev/fd/3持久绑定、后写追加;4<>双向;>与>>同写(管道无偏移);set -C不拦管道链接;关闭/未开的源 fd 在重定向时 ENOENT 报错(master 本已一致);dup 不是打开——echo x >&3对读端仍 EBADF(master 本已一致、不得回归);读游标不因追加移动;读端关闭后写入仍静默成功(procsub 记账保流身份,无 EPIPE 面);外部子进程对真管道的互补写双向可达。修法(端点种类机制,非路径名特判)
新增可追加字节通道端点:内存通道
FdWriteEndpoint::PipeChannel(Rc<RefCell<TextInput>>)——与源读端同一 Rc 分配,写追加队尾、读游标不动;内核管道则走fd::complementary_write_file在 unix 上对/proc/self/fd/{handle}做 O_WRONLY 魔法打开(正是 GNU open() 的动作),包成既有File端点。单一解析器fd_alias_complementary_write_endpoint只在写模式拼写打开且既有臂全部拒绝后被咨询,按源读端点种类(非 fd 编号)解析。消费方:ordered walk 的OutputTarget::PipeChannel、fd 表绑定器(复合/条件)、N<>别名臂的写方向、write_dev_stdio_redirect_output、外部阶段的捕获管道排流。无公开 API 变更(全部pub(crate),api-ledger 无 fd 模型符号),niu 侧零改动。顺带以机制修三处:ordered walk 的 Closed 种子让 dup 捷径抢答拼写目标、exec walk 的拼写目标助手为>/<>复制读端、外部目标链缺拼写互补分支(子字节曾漏到壳真 stdout 且状态 0)。Windows 边界(设计内):内核管道手柄在 Windows 上无互补打开 API,解析器 decline、保持 EBADF 现状;虚拟流(procsub/herestring)走内存通道载体、在 Windows 同样获得互补端。
验证
tests/issue2385_complementary_end.rs主会话 scrubbed 复跑 19/19;邻族 /dev/fd/N 拼写打开 socket 端点应 ENXIO 失败,现宽容 dup 供流 #2276 7/7、引擎特殊路径面核验:/dev/fd、/dev/tcp|udp、/dev/std{in,out,err} 对照 GNU 源码逐面核 #2359 16/16。fd_redirects钉(出生关 fd 子进程面,与本 PR 无关、已裁定)。顺带定性
#2256 目标的
issue2256_numbered_bind_then_dup_reads_fresh在 master 上确定红(主会话在 master 树与本 PR 树各复跑一致、本 diff 不触输入路径)——已另行立案 #2479。fix(fd): land dup redirects and >=10 placements, restore scope saves …