Repository navigation
fix(executor): attribute Lib/stdio diagnostic prologs to the frame file (Refs #3048) - #3711
Merged
Merged
Conversation
…le (Refs #3048) GNU builtins/common.c:83-94 builtin_error -> error_prolog names get_name_for_error (error.c:90-120) = BASH_SOURCE[0]; at a function call the innermost frame's source is the function's DEFINITION file (execute_cmd.c:5310-5313 execute_function pushes the recorded source_file). The executor stamps that composed view per command into the __RUBASH_CURRENT_FILE carrier (rubash#3035), and builtins::prefix::error_file_name composes CURRENT_FILE -> SCRIPT_NAME — but the residual Lib/stdio prolog compositions (PrologParts::Lib, set/unset diag_prolog, setattr diag_prolog, set/shopt prolog_for_env, and the alias/exit/shift process-env arms) still read __RUBASH_SCRIPT_NAME alone, pairing the frame's line with the top-level script's name (`unset -Z` inside a sourced function reported `drv.sh: line 1` instead of `./lib.sh: line 1`). Route every remaining script_file composition through prefix::error_file_name (made pub(crate)) so all prolog faces share one pairing with Executor::current_error_file_name. Pin: tests/issue3048_diagnostic_prefix_residuals.rs 16/16 green (unset invalid-option + readonly invalid-id were the last live residuals; top-level and own-file controls unchanged). Nested-source probe (`./lib2.sh: line 1`) byte-identical to WSL GNU bash 5.3.20. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
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.
Summary
script_filecompositions (PrologParts::Lib,set/unset/setattrdiag_prolog,set/shoptprolog_for_env, alias/exit/shift process-env arms) read__RUBASH_SCRIPT_NAMEalone — an error inside a function defined in a sourced file paired the frame's line with the top-level script's namebuiltins/common.c:83-94builtin_error→error_prolog→get_name_for_error(error.c:90-120) =BASH_SOURCE[0];execute_cmd.c:5310-5313execute_functionpushes the definition fileprefix::error_file_name(__RUBASH_CURRENT_FILE→__RUBASH_SCRIPT_NAME, the same pairingExecutor::current_error_file_namecomposes) and route all 8 remaining compositions through it —unset -Z/readonly 9bad=vinside a sourced function now report./lib.sh: line 1:Test plan
tests/issue3048_diagnostic_prefix_residuals.rs— 16/16 green (was 14/16; unset + readonly residuals now correct)./lib2.sh: line 1:byte-identical to WSL GNU bash 5.3.20Generated with Devin