Repository navigation
fix(executor): output redirects open each target once — umask 0200 no longer fails the redirect (Refs #3828) - #3835
Conversation
38de577 to
47994a8
Compare
|
【P1 车道复核】PR #3835 — 判词:CONFLICT(与当前 master 在
冲突点(两处,同一函数族)
两者不是相邻行夹具冲突:master 的 verdict 是 变绿需要什么
未关闭 PR / 未关闭 #3828(保持 OPEN)。 |
|
【WIN-AGENT-AUDIT】 PR #3835 第2轮 — 建议:FAIL(merge 已机械解开并推送,但 PR 自身 13 钉在 head 上仍红 5 格) 机制核查:
腿(逐项):
F 点:
续作记录:
未跑/VOID 的腿:
|
|
【WIN-AGENT-AUDIT】f1 冲突阻塞复核(第3轮)— 建议:FAIL(维持前轮判词;冲突已由前轮解开,本轮核实对现尖仍干净) head: 本轮 f1 分工仅为冲突面核实:
F 点(沿用第2轮,head 未变故不重跑):
续作记录:无(本轮未改代码、未 push)。 |
|
[i2 续作] head: af9dea0 (was 22ac944) 续作 commit
钉自跑(WSL Linux, 剩余 4 红的归因(WSL GNU Bash 5.3.20(1)-release 逐字节对照):
未跑/VOID:lib 双边、-D warnings、fail-first、CI 核查——本轮只到钉自跑 + GNU 对照,建议判词 PENDING(缺腿),两处真实残留需要下一轮续作。 |
|
[h2 续作] PR #3835 第4轮 — 建议:PENDING(缺腿:lib双边 VOID + push 被远端 head 推进阻断) 机制核查:
腿:
F 点(前轮 5 格红)逐条:
续作记录:
阻断/待决:
未跑/VOID 的腿:lib 双边(head/base);合并态钉复跑;marker-literals/utf8-boundary 脚本。 |
…e open (Refs #3828) GNU opens each output redirect target exactly once per redirect entry (redir.c do_redirections / do_redirection_internal / redir_open). The ordered walk's create/append open IS the entry's open: keep the File as a SharedFile instead of dropping it and re-opening by path at flush time — a target created with a mode lacking owner-write (umask masking 0200) fails the second open with EACCES although the kernel-level single open succeeds. Adds the File-returning probe twins (probe_output_redirect_file / probe_output_redirect_append_file); the ()-returning probes delegate to them, unchanged for callers. FIFO / net / special-class targets keep no File here. Inherited uncommitted work of the prior continuation lane, verified hunk-by-hunk against the issue and GNU semantics by the captain-direct continuation; the probe-then-bind wirings (exec / group / null-command / external spawn) follow in the next commit. UNVERIFIED-BY-CAPTAIN.
…ets (Refs #3828) GNU opens each output redirect target once per entry (redir.c:237 do_redirections -> do_redirection_internal, redir.c:790 -> redir_open, redir.c:949); under a umask masking 0200 the created file lacks owner-write and rubash's second open by path fails EACCES. Pins cover create/write/append, exec 3>/2>, group 2>, external /bin/echo, <> and the pre-existing-444 control.
…s own open (Refs #3828) GNU opens each output redirect target once per entry (redir.c:237 do_redirections -> do_redirection_internal, redir.c:790 -> redir_open, redir.c:949). The persistent-exec walk and the compound scope walk probed the target (creating it) and then bound it with a second open by path; a target created with a mode lacking owner-write (umask masking 0200) fails that second open EACCES. Adopt the probe's File via probe_output_redirect_file + set_fd_output_file_from_file, so the probe's open IS the entry's one open. FIFO / net / special targets probe to None and keep the plain bind, whose open stays their single pairing open (rubash#2880); append arms already bind in one open.
…rough the probe's own open (Refs #3828) GNU opens each redirect target exactly once per entry (redir.c do_redirections :237 / do_redirection_internal :790 / redir_open :949); a target created with a mode lacking owner-write (umask masking 0200) fails a second open with EACCES although the single open succeeds. This completes the probe-then-bind sequencing: - external spawn: execute_external_inner runs the preflight as command_output_redirect_fails_with_preopened and hands its preopened map to the plan (fd 1/2 adopt the gate's description via adopt_preopened_combined_target) and to the spawn delivery (fd >= 3 adopt via the existing collect_external_fd_delivery preopened channel, rubash#3311). The env leg and the async spawn paths run no preflight and keep opening by path (residual). - no-output builtins: redirect_setup_open_error records the list positions it really opened (plain filesystem targets only); the mirror skips its own re-open at recorded positions. Input entries are never recorded (the mirror's positional probe may resolve a different in-list binding); `>&WORD` is a first open (DuplicateOutput is never probed). - dedup: the duplicate set_fd_output_file_from_file definition and the unadopted set_fd_readwrite_file_from_file are removed (exec/compound `<>` are single-open already; the mirror uses the skip-set, so no adoption site exists); the bool-only command_output_redirect_fails wrapper and the now-unused probe_output_redirect_append wrapper are removed. Pins (tests/issue3828_umask_redirect_permission.rs, 13 cells) are UNRUN: no build route (VM->server egress proxy down, box hibernated, no local cargo). Legs owed after the route recovers: pin stem + lib bilateral + RUSTFLAGS="-D warnings" check + fmt.
…lesystem check (Refs #3828) CI run 44038661354 failed the lib build with E0308 at src/executor/redirection.rs:3734:65: classify_special_path takes &str (special_paths.rs:119) but the walk's target is a String here (redirect_output_path_target returns String, shell_options.rs:2733). Borrow it; no behavior change.
…h to real exec (Refs #3828) The emulated-external preflight ran apply_redirect_setup_side_effects before knowing whether an emulation arm would answer. For literal executable spellings (/bin/pwd, /bin/printf, ...) the arms decline to the real exec path, so the walk's probe open created the target under the umask-stripped mode and execute_external_inner's own preflight open then failed EACCES — GNU's single do_redirections open (redirection.c:237 -> redir_open redir.c:949) succeeds once. Gate the walk on emulated && !literal_file_declines so only commands an arm will actually emulate pay the side-effect walk.
…lk (Refs #3828) GNU do_redirections opens every redirect entry exactly once (redir.c do_redirection_internal -> redir_open). rubash splits that open across an earlier validate/prepare walk and a later bind walk; the first walk dropped its File, so the bind re-opened the path and failed EACCES on a file created without owner-write (umask masking 0200). Retain the first walk's FileFd in pending_preopened_redirects keyed by cmd.redirects position; consumers adopt on exact target match, so stale entries can never bind the wrong file. - external commands: apply_redirect_setup_side_effects_retained feeds the spawn gate's preopened map (was: probe opened, gate re-opened) - brace groups: prepare_brace_group out/err arms retain via create_redirect_output_prepared_open_for; the compound bind adopts - `<>`: the reject gate's open_readwrite_pair parks its FileFd; the setup walk's probe skips the already-opened position - pins: append/control expectations corrected to verified GNU 5.3.20 behavior (second `>>` and the script rc are GNU's own answers) Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
af9dea0 to
f4ba7d9
Compare
|
【WIN-AGENT-REWORK】h2 续作完成 — 建议:PASS 产品面 5 格红的修复(承接上轮 PENDING):
腿(全在 rebase 后 head
rebase 冲突处理: |
Refs #3828
根因
当
umask掩掉0200时,输出重定向创建的文件缺 owner-write 位,rubash 误报Permission denied、数据丢失;单次内核 open 本应成功。GNU 对每个重定向条目只 open 一次目标(redir.c
do_redirections:237 /do_redirection_internal:790 /redir_open:949,fd = redir_open(...); if (fd < 0) return (errno);)。rubash 的 probe-then-bind 在多条路径上把同一目标 open 两次:有序 walk(open_command_output_target)open 后丢弃 File,只记 Path,flush 时按路径重开;exec / group / null-command / external spawn 的 gate 与 bind 各自再 open 一次。已创建的 mode 000/444 文件第二次 open 即 EACCES。本 PR
c84db5c6):有序 walk 的 create/append open 即条目的那一次 open——File 以SharedFile保留,flush 经该 handle 写,不再按路径重开;新增 File 版 probe 双生子(probe_output_redirect_file/probe_output_redirect_append_file),原()版 probe 改为委托,调用方行为不变。FIFO / net / 特殊类目标仍不保留 File。5ff2893e):回归钉tests/issue3828_umask_redirect_permission.rs,13 格(创建/写/append/exec/group/外部命令/<>/控制格),#![cfg(unix)],root 下经 setpriv 以 nobody 跑。770ac85f):exec 持久绑定与 compound scope 的输出重定向经 probe 的 open 绑定(set_fd_output_file_from_file,7 处调用点)。47994a87,定序):external spawn 的 preflight→spawn 接线(command_output_redirect_fails_with_preopened,fd 1/2 经adopt_preopened_combined_target采用 gate 的描述符,fd ≥ 3 经既有collect_external_fd_deliverypreopened 通道);no-output builtins 的 gate/mirror skip-set(pregate 记录真实打开的 plain-file 位置,mirror 跳过已记位置的二次 open;: > f > g不做 undo-delete,FIFO/net/special 不记录,Input 条目不记录);删重复定义与死代码(见下)。本 PR 删除了什么
trap_exec.rs中重复的set_fd_output_file_from_file定义一处(未提交版签名(fd, file, target, dynamic),零调用点;保留已提交版(fd, target, dynamic, file)及其 7 处调用点)。set_fd_readwrite_file_from_file(零采用点:exec/compound<>本就是单次 open,mirror 的<>用 skip-set 而非 adopt,留着会是 dead_code)。command_output_redirect_fails包装(唯一调用点已改用_with_preopened,留着会是 dead_code)。()版probe_output_redirect_append(唯一调用点已改用_file双生子;其文档注记并入_file版)。余项(未修,见 REPORT)
env腿与spawn_async_direct(后台/ENOEXEC spawn)不跑 preflight,仍按路径二次 open。apply_external_fd_delivery传None),stage 的 fd ≥ 3 delivery 仍按路径 open;routing walk(route_pipeline_stage_streams_inner)对 fd 1/2 的二次 open 未动;<>in pipelines 未动。set_fd_readwrite_file_from_file的删除系定序裁决的修正:原裁决谓之“改接”,核查后无采用点存在,删之并记 REPORT §11。验证状态
UNVERIFIED-BY-CAPTAIN。本轮无构建路线:VM→服务器出口代理中断(198.19.0.1:3128 banner 超时),服务器 Linux 腿与 X299 链同时切断;Simular box 休眠且钱包空;本地无 cargo/rustc/rustfmt,写墙 EDQUOT 间歇关闭。13 格钉从未跑过(fail-first 与修后绿均未证实);lib 双边、
RUSTFLAGS="-D warnings"check、fmt/hygiene 均欠。路由恢复后补跑(见 REPORT);在那之前不许称绿。