## 现象 当前目录被删除后,前台外部命令 spawn 全部失败 rc 127(`cannot execute: required file not found`);管道段与进程内命令对照正常。GNU 同形正常执行 rc 0。 ## 最小复现(master `f17644d7` 实测,oracle = GNU bash 5.3.20;删除须在被测 shell cd 进入后、单次调用内发生) ```sh D=$(mktemp -d); mkdir "$D/a"; cd "$D/a"; (cd ..; rmdir a) wc "$D/f"; echo rc=$? # GNU:正常执行,rc=0 # rubash:/usr/bin/wc: cannot execute: required file not found,rc=127 ``` ## 证据(r88 裁决轮) - seed:GNU 6/6 PASS;rubash 4 FAIL(前台 `wc <文件>`、裸 `ls`、`grep -q < 文件`、无参 `id` 全 rc 127)+ 2 对照 PASS(管道内 `wc -l`、进程内文件内建 `cat`)。 - morph2:mD1、mD2、mD3、mD8、mD9(`sh -c`)、mD10(命令替换内 `id -u`,错误文案被替换捕获)DIFF;mD4–mD7 对照 SAME。分界 = 前台 spawn vs 管道/进程内。 - 源码面:前台 spawn 路径无条件 `process.current_dir(&self.shell_state.cwd)`——`src/executor/external_inner.rs:464`、`:1232`、`:4187`、`:4219` 等多处;子进程 chdir 到已删的陈旧逻辑 cwd 路径字符串报 ENOENT,execve 永不发生。 ## 修法方向 对照 GNU 机制定:bash 不在 spawn 前按逻辑 PWD 字符串重做 chdir,子进程继承进程真实 cwd(已删目录仍是有效 cwd,绝对路径 exec 不受影响)。rubash 侧消除「按逻辑 cwd 字符串无条件 current_dir」这一层,或在其不可解析时回退为继承进程 cwd;多处调用点须同机制统一处理,不逐点打补丁。 ## 归宿 executor spawn 面单派:`external_inner.rs` 为多车道活文件区,派工前查在飞 PR 撞面并做面核;优先级高于同轮 pushd 两单。
Activity
style: cargo fmt on the W-SPAWN lane files (Refs #3198, Refs #3201)
spawn: read emulated-cat operands through the cwd anchor; snapshot 25…
spawn: deleted-cwd spawn anchor + comsub ambient fd delivery + procsu…
caomengxuan666 commentedon Nov 10, 2026
队长关单(PR #3234 合入
a78f0cde后亲核)。修法与钉均已落地:deleted-cwd spawn anchor 修法随 PR #3234 合入;终头
2f0e6225上钉issue3198_deleted_cwd_spawn7/7(box 复跑 rc=0,含返工轮的真红格relative_parent_still_resolves已转绿),CI 10 pass + 1 skipping 零红。复核全账见~/workspace/review-3234/(CAPTAIN-VERIFY.md + REWORK-REVIEW.md + MERGE-REPORT.md)。executor: keep a stationary session out of a recreated cwd ghost (ide…
executor/builtins: cd and shell-side redirects spend the cwd anchor f…