Repository navigation
api: Session::run diagnostic text is the input text, not the source name (Refs #2860) - #2888
Merged
Merged
Conversation
… not the source name (Refs #2860) The line route of Session::run passed `source_name` (the run's name, or the session's argv0 seed) into run_source_with_line_offset's diagnostic_text parameter. That parameter is the text the parse's offending-line echo reads: GNU parse.y:6814 print_offending_line (from report_syntax_error, parse.y:6833) echoes the verbatim line of the shell's INPUT. With a name in the slot, a named run echoed the name itself for a one-line input (`bash: `bash'` for `echo a;;`) and a space-joined token reconstruction for a later line (`` `echo ) bad' ``); unnamed runs fell back to the input text and echoed verbatim, which is why the GAP-2 diagnostic-value pins could not see the defect. The grouped route was never affected (its per-group parses pass no diagnostic text and fall back to the group text). Pass the input text explicitly. The name keeps its own jobs: the diagnostic values' source_name and the run event record. Pins (consumer_tests, child-process stderr capture per the issue2084 pattern, because the echo is text on fd 2, not a diagnostic value): a source named via RunOptions.source_name and a session seeded with builder argv0 (the host's script-file shape) both echo every offending line verbatim across the stray-close shapes, with GNU's line-unit prefix rule (earlier lines run, the offending line's own commands never do). Mutation-checked: both pins fail with the name restored to the slot. 本 PR 删除了什么: the mis-threaded argument only — no code deleted; the change is one argument plus its comment, and two pins (+123 lines in consumer_tests.rs). Net: +138/-1.
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 #2860 (engine half; the host half retires niubash's last direct
script_drivercall onto this contract — captain sequences the §2.1 ledger row and closes the issue).What this fixes (Q-B of the #2860 ruling)
Session::run's line route passedsource_name— the run's name, or the session'sargv0seed — intorun_source_with_line_offset'sdiagnostic_textparameter. That parameter is the text the parse's offending-line echo reads: GNUparse.y:6814 print_offending_line(fromreport_syntax_error,parse.y:6833) echoes the verbatim line of the shell's input.Measured pre-fix behavior of the contract (lane probes P-S5/P-S6, GNU 5.3.20 oracle):
echo a;;→ echo line is`bash'— the NAME echoed as the offending line.echo ok\necho )bad→`echo ) bad'— space-joined token reconstruction.The fix passes the input text explicitly (
Some(source)). The name keeps its own jobs: the diagnostic values'source_nameand the run event record. No public surface changes — the api-ledger is untouched by this PR.Pins
Two pins in
src/api/consumer_tests.rs, using the issue2084 child-process pattern (the echo is text on fd 2, not a diagnostic value, so the parent asserts on the child's captured stderr):issue2860_named_source_echoes_the_input_line_not_the_name—RunOptions.source_name = "bash".issue2860_argv0_seeded_session_echoes_the_input_line_not_the_name—Session::builder().argv0("gap2860.sh"), the host's script-file shape.Both run one scenario (
echo a;;/ two-line prefix / same-line prefix / subshell list) asserting value surface in the child and verbatim echo + line-unit prefix behavior in the parent. Mutation-checked: with the name restored to the slot both pins fail; with the fix both pass. Neighborhood:api::consumer_tests114/114,--test session_api19/19,--test issue845_subshell_stray_close_regressions6/6.本 PR 删除了什么
Nothing deleted — the change is one mis-threaded argument plus its explanatory comment in
src/api/session.rs, and the two pins (+123 lines inconsumer_tests.rs). Net: +138/−1 across 2 files.