Repository navigation
driver: read-time set -v echo; job-control diagnostics print shell_pgrp (W-I2) - #3239
Merged
Merged
Conversation
…ntrol diagnostics set -v (verbose): GNU echoes each input line to stderr as it is READ, under the flag state then in effect (flags.c:284 echo_input_at_read = verbose_flag; parse.y:2712 prints shell_input_line; heredoc secondary lines via make_cmd.c:584). The engine instead echoed the RENDERED command at execution time from Executor::set_current_command: a `;`-joined line echoed once per command with comments dropped, a multiline compound echoed per stage and per iteration, comment/blank/continuation lines never echoed, and -c strings sampled wrong. - script_driver::echo_verbose_input_lines is the single echo point, called at every real read point: the grouped reader's per-line consumption (read_next_source_group), the stdin script reader's per-line read (run_stdin_script), and the whole-string read boundaries (the -c and Session fast paths, reached only when the toggle scan below shows the entry state holds for every line, and parse_and_execute strings via execute_eval_source). - script_driver::script_may_toggle_verbose is an over-admitting routing scan in the script_may_set_onecmd family shape: texts that may toggle verbose mid-read (set -v/+v, a bundled -/+...v, set -o/+o verbose, or a ./source/eval unit whose body can) take the grouped reader on the script-file, -c and Session routes; a script file entered with verbose already on takes it too. A false positive only costs the incremental driver. - The execution-time echo arm in set_current_command is deleted; the preamble keeps only its $BASH_COMMAND bookkeeping. - Job-control diagnostics: GNU prints shell_pgrp (jobs.c:4737 getpgid (0) at initialize_job_control entry; diagnostics at jobs.c:4844/4853). Both establishment print sites (the script_driver funnel and main.rs's non-interactive -m arm) printed the shell's pid instead; they now share script_driver::shell_process_group_id. Refs #2773 Refs #2774
This was referenced Nov 11, 2026
caomengxuan666
marked this pull request as ready for review
November 11, 2026 03:51
This was referenced Nov 11, 2026
Closed
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.
Wave-2 pin-to-fix lane W-I2 (driver / interactive face). The two pin files are carried verbatim from pin PR #3172 (branch
test/wave2-pins-i2, head64209f64) as the first commit of this branch; that pin PR itself is left for the captain to dispose of.Refs #2773
Refs #2774
Mechanism
Verbose echo (
set -v): GNU echoes each input line to stderr as it is READ, under the flag state then in effect (flags.c:284echo_input_at_read = verbose_flag; parse.y:2712 printsshell_input_line; heredoc secondary lines echo via make_cmd.c:584read_secondary_line). The engine echoed the rendered command at execution time fromExecutor::set_current_command, which split;-joined lines per command, dropped comments, re-rendered compound bodies per stage and per iteration, and never echoed comment, blank, or continuation lines.script_driver::echo_verbose_input_lines, called at every real read point: the grouped reader's per-line consumption (read_next_source_group), the stdin script reader's per-line read (run_stdin_script), and the whole-string read boundaries (the-cand Session fast paths, and parse_and_execute strings viaexecute_eval_source).script_driver::script_may_toggle_verbose(same family shape asscript_may_set_onecmd): a text that may toggle verbose mid-read takes the grouped reader on the script-file,-c, and Session routes; a script file entered with verbose already on takes it too. The fast paths keep a single boundary echo, which is the same answer when the scan shows the entry state holds for every line. The scan only routes; it decides no semantics.set_current_commandis deleted (see the deletion section below).Job-control diagnostics: GNU prints
shell_pgrp— jobs.c:4737shell_pgrp = getpgid (0)atinitialize_job_controlentry, reported by jobs.c:4844/4853. Both establishment print sites printed the shell's pid instead; they now sharescript_driver::shell_process_group_id(). The monitor-mode establishment itself was already correct (the second pin is a regression lock, green before and after).GNU anchors
-cstrings read line by line like files (mid-string toggles start/stop the echo), heredoc body and delimiter lines echo, sourced-file lines echo with the toggle persisting after return, stdin scripts echo per line read, and the job-control diagnostic names the inherited process group when pid != pgid.Verification (Simular box, this branch head
1eecaa94one1afd25d)Local build environment was under a write wall (probe battery FAIL), so all build legs ran on the Simular box; the numbers below are per-stem
test resultlines from those logs.beab07dc: verbose stem 1 passed / 7 failed (only the toggle cell green, by coincidence of rendering); job-control stem 4 passed / 0 failed (regression lock — matches the pin lane's own record on the older base).RUSTFLAGS="-D warnings"on product code (--lib --bins): rc=0. The--all-targetsform is red only on a pre-existing unused variable intests/issue2078_session_parse_cache_regressions.rs:129, byte-identical failure on the base commit; this branch does not touch that file.cargo fmt --checkfull tree: rc=0.Collision notes for sequencing
Open PRs touching files in this branch, all with hunks distant from these changes: #2968 (public_accessors, trap_exec), #3135 (public_accessors), #3234 (trap_exec), #3238 (trap_exec). No open PR touches
src/script_driver.rs,src/main.rs, orsrc/api/session.rs. Master has advanced past this branch's base since the rebase (e1afd25d); an update-branch may be needed before merge.本 PR 删除了什么
Executor::set_current_command(src/executor/public_accessors.rs): theif shell_option_enabled(..., "verbose")block that wrote the renderedbash_command_source_text(cmd)to stderr, together with its comment block (14 lines). The$BASH_COMMANDbookkeeping that shares the preamble is kept; only the echo is gone, replaced by a comment pointing at the read points.