Repository navigation
test(executor): derive part_024 dirs expectations from live cwd (Refs #3397) - #3471
Conversation
…3397) part_024's three dirs cells expected `dirs` output to follow a temporary `PWD=` assignment. GNU prints the real working directory in every form: dirs_builtin takes element 0 from get_working_directory ("dirs") (builtins/pushd.def:431,489-494) and prints it through polite_directory_format (general.c:953), which only abbreviates a $HOME prefix to `~`. A `PWD=` prefix never chdirs, so it cannot steer `dirs` — verified against GNU 5.3.20 in four forms (temporary prefix, standalone assignment, `builtin dirs`, inherited env). The three cells now derive the expectation from the live cwd with the same `~` abbreviation the product applies (src/builtins/pushd.rs:30 polite_directory_format; element 0 is the validated cwd, never raw $PWD — src/builtins/pushd/stack.rs validated_stack_top, rubash#2408). Test-only change, zero product code. Refs #3397
|
【WIN-AGENT-AUDIT】 机制核查:
腿(逐项给数字与名字):
F 点:
未跑/VOID 的腿:
|
…m (Refs #3397) Rework per WIN-AGENT-AUDIT round 1: - F1: expected_dirs_output() derived the expected cwd from std::env::current_dir()'s native X:\... spelling, but the dir stack entry the builtin prints is stored in the canonical POSIX /<drive>/... display form (executor/path.rs:7957 shell_pwd_display_path). Derive the expectation through the same normalization (mirrors issue659's test-side posix_display_form; the engine function is pub(crate), unreachable from integration tests). - The C:/Users/cmx abbreviation branch now mirrors polite_directory_format (builtins/pushd.rs:30) faithfully: it compares the POSIX-form display name against the executor env's raw HOME, including the USERPROFILE / HOMEDRIVE+HOMEPATH fallback Executor::new injects on Windows when HOME is absent (executor/init.rs:510-519). Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
|
【WIN-AGENT-REWORK】 F 点逐条回应:
腿(逐项):
|
|
【WIN-AGENT-REWORK】F3 波批次汇总 — 5/5 全部处置完毕
处置摘要:
合规记录:全部叠加 commit 无改写、无 force push、squash 合并不删分支、未碰禁碰清单。fmt 披露:两仓本机 遗留(非本 lane):rubash 上游 终报: |
根因
tests/executor_command_chaining/part_024.rs三格dirs测试的期望编码了错误行为:期望dirs输出跟随临时PWD=赋值。GNU 在任何形态下都印真实 cwd ——PWD=前缀只给命令环境设变量、从不 chdir,不可能操纵dirs输出。产品「不跟随 PWD」恰是 GNU 行为;按旧期望改产品反而会引入真分歧。GNU 锚点
dirs_builtin(builtins/pushd.def:431):首项取自get_working_directory ("dirs")(pushd.def:489-494),经polite_directory_format打印(pushd.def:494 DIRSTACK_FORMAT)。polite_directory_format(general.c:953):仅当$HOME长度 > 1 且路径等于$HOME或以$HOME/开头时把前缀缩写为~。~/workspace/fix-3397/probe/gnu-dirs-four-forms.sh,本轮复跑复现):临时前缀赋值、独立赋值、builtin dirs、继承 env 入场——四形一律印真实 cwd(/tmp/rubash-dirs-probe);HOME 下印~。src/builtins/pushd.rs:30 polite_directory_format与 GNU 同款缩写;元素 0 为校验过的 cwd、永不取原始$PWD(src/builtins/pushd/stack.rs validated_stack_top,rubash#2408;校验面 rubash#2143)。改动(仅测试面,零产品改动)
三格(
test_dirs_redirects_output/test_dirs_appends_output/test_builtin_dirs_redirects_output)期望改为派生值:实时 cwd + 同款~缩写;PWD=前缀保留作钉子,重定向面(>/>>落盘内容)仍为被测对象。另修正注释中一处错误引用(executor/init.rs #3268→:326,env 快照在new_inner)。本 PR 删除了什么
"/tmp/rubash-dirs\\n"、"before\\n/tmp/rubash-dirs\\n"、"/tmp/rubash-builtin-dirs\\n"(即「dirs 跟随 PWD=」的错误期望)。未删除任何测试、未删除任何产品代码。验证(本轮)
scripts/check-utf8-boundary-hygiene.shclean;scripts/check-marker-literals.pyOK(117 registry consts,268 allowlisted sites)。part_024全 stem 与 base 逐数对齐、全量 lib 对齐、RUSTFLAGS="-D warnings" cargo check --locked --lib --bins、cargo fmt --check。Refs #3397