Repository navigation
fix(path): describe of a fresh PATH walk prints the as-written join - #3215
Merged
Merged
Conversation
…Refs #3147) GNU findcmd.c:553 find_in_path_element builds ONE string -- the sh_makepath(xpath, name, 0) join of the PATH element verbatim -- and builtins/type.def:379/381 describe_command prints that string for type / command -v / type -a. The fresh (unhashed) describe faces in rubash print the session-cwd-anchored resolution instead (/tmp/<fixture>/./rel1/foo). Pins cover command -v, type, type -p, type -P, type -a, relative/dot/empty/trailing-slash elements, the post-cd anchor, plus hashed-spelling and not-found locks. GNU bash 5.3.20 oracle outputs, LC_ALL=C.UTF-8.
…tion change) (Refs #3147)
…#3147) command_path_with_bridge gains a describe_spelling flag: the describe faces (command -v / type) print the walk's one constructed as-written <elem>/<name> join via recorded_resolution_spelling (the #2696 anchor-equality determination), while the execution-decision face keeps the anchored form. command_paths' existence probe now anchors at the session cwd (anchor_at_session_cwd, made pub(crate)) so relative elements still match after cd, while the displayed string stays the unanchored join.
caomengxuan666
marked this pull request as ready for review
November 11, 2026 11:17
caomengxuan666
added a commit
that referenced
this pull request
Nov 11, 2026
…ed argv0 chain (#3356) Refs #3256 ## What this wave does The (b) wave of the diagnostic-prefix convergence (the first wave landed as PR #3352). The ten faces that had to wait each derived their diagnostic name privately — a hard-coded fallback literal, the shell-name carrier printed verbatim as the interactive name, or a process-env prolog that cannot see the interactive carrier at all. The renamed-shell experiment against the GNU 5.3.20 oracle showed GNU has exactly one name source for all of these faces (`error.c:90-120 get_name_for_error`; `shell.c:1797/1804`), and measured four divergence classes at the CLI. This PR migrates every remaining face onto the single argv[0] carrier chain in `builtins::prefix`: - `builtins::prefix` gains a `sys_error_prefix` renderer (`error.c:275-281`: name segment only, never a line segment). - `builtins/diagnostic.rs` — the diagnostic / sys_error / err_readonly builders delegate to the chain behind the interactive arm (basename, no line segment). - Lib Prolog faces — `alias.rs`, `set.rs::prolog_for_env`, `setattr.rs`, `set/unset.rs`, and `PrologParts::Lib` in `executor/builtin_diag.rs`: the error name comes from the chain's fallback derivation and the interactive name cell holds the basename derivation instead of the raw shell-name carrier. - `alias`/`unalias` now take the dispatcher's composed prolog (`Executor::diagnostic_prolog`), for the same dispatcher-owns-the-prolog reason as the Stage-2 ④ D3 migration: the lib prolog reads the process env, and the interactive carrier is never mirrored there. - `builtins::set::builtin_error_prefix` (production consumer: the TIMEFORMAT diagnostic in `executor/read_helpers.rs`) derives every arm from the chain; the eval frame's `eval:` segment, which has no chain counterpart, keeps its existing shape. - `setattr.rs`'s readonly prefix delegates to the chain's err_readonly renderer outside the interactive arm. ## 本 PR 删除了什么 - The literal-prefix shim in `executor/trap_exec.rs` (`execute_exec`'s no-operand path): it rewrote buffered builtin stderr beginning with the literal `rubash: ` to the executor's prefix. The builtin face now derives the same prefix from the same carriers through the shared chain, so the literal it matched can no longer be produced; the rewrite is removed rather than left as dead code. The script-form bare-exec cells of the new pin (and of the first wave's pin) cover the path it served. - `builtins/diagnostic.rs`'s private `error_file_name` helper, subsumed by the chain's renderer inputs. - Two expectation cells in `tests/executor_tests.rs` (`builtin_error_prefix_three_modes_match_gnu`) that encoded the old hard-coded fallback name: the line-only and carrier-less arms now end at the chain's terminal fallback, GNU's PROGRAM `bash`. This is a deliberate expectation change following the migration ruling, recorded here rather than silently edited. - Two expectations in `tests/executor_command_chaining/part_023.rs` (`test_cd_redirects_stderr`, `test_cd_appends_stderr`): under the bare `Executor::new()` embedding (a line carrier but no file/name carrier) the cd diagnostic now renders the chain's line-only arm, `bash: line 1: cd: ...`, instead of the old face's hard-coded `rubash: ` fallback — the same shape the executor's own prefix locks for this embedding. Verified bilaterally in captain review (both pass on the head tree with the new expectations; the executor_tests failure name-set is byte-identical between base and head). The neighbouring `times` expectations in `part_024.rs` fail identically on both trees — a pre-existing, environment-sensitive red outside this wave's faces — and are untouched. ## Evidence - New regression pin `tests/issue3256_renamed_prefix_matrix.rs` (whole stem `#![cfg(unix)]`, like its sibling stem): renamed invocations (arg0 rename; a physically copied binary invoked by absolute path) across the lib-reachable faces (alias, export, readonly, unset, exec, cd's sys_error face, the TIMEFORMAT face) in -c, script, and interactive forms, plus direct calls of the public prefix face. Expectations are the GNU 5.3.20 outputs from the dossier's renamed-matrix experiment. - Fail-first, captain re-run on the PR's true base `f5f65d35` with the pin topped up: 3 passed / 6 failed — the six reds are exactly the interactive cells and the chain API cell, matching the experiment's four divergence classes; the -c and script cells pass on both sides (the startup seed already fed those faces the invocation name) and lock the migration against regression. On this head: 9 passed / 0 failed. - The eval arm of `builtin_error_prefix` has no chain counterpart and no GNU interactive measurement behind it; it is pinned in its existing shape only (script + line + eval carriers), and that limitation is stated in the wave's report section rather than presented as coverage. - Captain review (dossier `review-3356/CAPTAIN-VERIFY.md`): lib bilateral base 1245/0/4 vs head 1246/0/4 (difference is exactly the new sys_error unit test), failure name-sets empty on both sides; executor_tests failure name-sets identical at 57 on both sides (the box part_* environment family, pre-existing); issue1768 name-sets identical bilaterally (known base reds); -D warnings / marker-lint / UTF-8 hygiene / fmt all rc=0 on the head; final-head CI 11 legs all finished, zero red. - The PR's branch base is `f5f65d35`; the lane's report ran its fail-first against the ancestor `20ba3aea` (the interval between them is PR #3215's two files, zero intersection with this wave's faces). The captain's re-run on the true base reproduces the lane's numbers exactly. Closing-word scan (captain merge discipline): this body and the PR title were scanned in full; the only issue reference is the standalone `Refs #3256` line above, and no closing-keyword word form appears in any sentence containing an issue reference.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs #3147
问题
未执行过(未入 hash 表)的命令做 fresh PATH walk 描述时,
command -v/type打印锚定到会话 cwd 的绝对路径(带/./残留),GNU 打印 walk 构造的 as-written join 本身:GNU 依据
find_in_path_element:walk 只构造一个字符串——sh_makepath(xpath, name, 0),即 PATH 元素原文与命令名的 join。describe_command从find_user_command/user_command_matches(-a)取得该字符串,:425/:427 原样打印(CDESC_SHORTDESC / CDESC_REUSABLE 面)。已记录(hashed)情形的同一 join 已由 [A2-13] Hash table stores absolutized path; type prints it instead of the as-found relative spelling #2696 以记录拼写修复;本 PR 处理未记录情形的 describe 显示面,落点在 describe 层(command_path/command_paths),不动执行 walk 与command_path_without_bridge的执行判定消费者。本 PR 删除了什么
无删除。仅新增回归钉文件与 describe 层拼写修正(净行数随验证完成后回填)。
验证
验证进行中(钉 fail-first → 头钉 → lib 双边 → 邻茎 →
-D warnings→ fmt),数字完成后回填本节。