Repository navigation
fix(interpreter): diagnostics carry bash's "$0: line N:" prefix - #2630
Merged
Merged
Conversation
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
bashkit | 8a800d1 | Commit Preview URL Branch Preview URL |
Oct 08 2026, 04:34 AM |
chaliy
force-pushed
the
claude/diag-line-prefix
branch
3 times, most recently
from
October 8, 2026 03:59
d50cd0d to
03702b8
Compare
Shell diagnostics now read like non-interactive bash: `SCRIPT: line 2: x: command not found`, `bash: line 1: type: h: not found` under -c, instead of a bare `bash: `. The name is BASH_SOURCE[0] when a file is being read (a sourced file names itself), else $0. - Interpreter messages go through Interpreter::diag_prefix / diag. - Bundled builtins keep their `bash: name:` / `name:` text; the builtin dispatch point rewrites the line start before redirects or streaming see it. Usage lines, coreutils-style builtins and execution plans are untouched. - eval syntax errors read `$0: eval: line N:`; failglob, arithmetic and write-error messages honor $0. - `source missing` ends with a newline and reports the missing path; `source` with no operand exits 2 with bash's usage line. - Redirect failures on while/for/if/case report the closing line. - `set -u` names a bare positional `$2` like bash. - Child shells (bash -c, scripts by path) get their own name and lines. - Bash::set_interactive (used by the CLI REPL and Terminal) keeps the `bash: msg` form of `bash -i`. bash-oracle: match 92 -> 98, strict 71 -> 89 of 106 (with #2622) (floors raised).
chaliy
force-pushed
the
claude/diag-line-prefix
branch
from
October 8, 2026 04:33
03702b8 to
8a800d1
Compare
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.
Requested by Михайло · project thread
What changed
Shell diagnostics now carry bash's non-interactive prefix: the running script's name and line (
$0: line N:) instead of a barebash:. This covers interpreter errors (command not found, arithmetic, redirects, readonly,set -u, failglob) and the shell builtins bash ships (cd,read,type,pushd,source, …). Coreutils-style builtins keep their owncat: missing: ...form, as on a real system.bash -cchildren printbash: line N:.Bash::set_interactive(true)(used by the CLI REPL andTerminal) keeps thebash: msgform ofbash -i.source missingreportsSCRIPT: line N: missing: No such file or directory;sourcewith no operand exits 2 with bash's usage line.while/for/if/case ... done < freport the closing line.set -u, a bare positional is named$2, as bash does.Why
Agents read stderr to locate a failure. Bash's
script.sh: line 12:points at the line; bashkit'sbash:did not. It was also the largest stderr gap on the bash-oracle scoreboard.Before / After
Before, every one of these lines started with
bash:and no line number. After:The "Did you mean" hint is a deliberate sandbox feature and stays.
bash-oracle on 106 cases: match 92 → 98, strict 71 → 89 (one each from #2622 SHLVL, now on main) (floors raised in
floor.txt).Risk
Diagnostic text changes, so callers that matched
bash: ...exactly will see the new prefix. Lines startingbash:are rewritten at the single builtin dispatch point; the decision is recorded at the top ofinterpreter/mod.rs. Known remaining gaps are inknowledge/operations/limitations.md("Diagnostic prefix"): compound commands without spans report a stale line, and functions from sourced files name the caller's file.Checklist
tests/integration/diagnostic_prefix_tests.rs(23 cases, expected text checked against bash 5.2)cargo fmt, clippy-D warnings, integration (1431), lib (2933), bashkit-cli,bash_comparison --ignoredGenerated by Claude Code