Conversation
Bash reports signals that were ignored (SIG_IGN disposition) when the shell started, e.g. `trap -- '' SIGRTMIN`, via `trap -p`. Brush now captures the ignored-on-entry signals at shell creation and displays them, matching bash output in environments where such signals are ignored (e.g. SIGRTMIN in CI runners). SIGPIPE is excluded from the captured set because the Rust runtime always sets it to SIG_IGN at startup, which does not reflect the parent process's disposition. Assisted-by: opencode:deepseek-v4-flash-free
Public API changes for crate: brush-coreAdded itemsPerformance Benchmark Report
Code Coverage Report: Only Changed Files listed
Minimum allowed coverage is Test Summary: bash-completion test suite
|
The signal-number-to-name mapping for standard signals only holds where a real `Signal` enum exists (unix); the stubbed platforms (e.g., Windows) fall back to a numeric name. Also make the stub `real_time_signal_name` a const fn to satisfy clippy's missing-const-for-fn lint. Assisted-by: opencode:deepseek-v4-flash-free
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
Bash reports signals that were ignored (
SIG_IGNdisposition) when the shell started — e.g.trap -- '' SIGRTMIN— viatrap -p. Brush currently only prints explicitly registered handlers, so environments that ignore a signal on entry (like the GitHub Actions runner ignoringSIGRTMIN) produce atrap -pdiff against bash.This PR makes brush capture the ignored-on-entry signals at shell creation and report them in
trap -p, matching bash.Changes
brush-core/src/sys/unix/signal.rs: newignored_signals_on_entry()queries each signal's disposition viasigaction, including real-time signals (SIGRTMIN..SIGRTMAX) on Linux/Android.SIGPIPEis excluded: the Rust runtime always sets it toSIG_IGNat startup for every Rust program, which does not reflect the parent's disposition, while bash (a C program) starts withSIG_DFLin comparable spawn scenarios.brush-core/src/sys/stubs/signal.rs: stub returns an empty set.brush-core/src/traps.rs:TrapHandlerConfigstores the ignored-on-entry signal numbers; newsignal_name_for_number()names signals the way bash does, including real-time naming (SIGRTMIN,SIGRTMIN+1,SIGRTMAX-1, …).brush-core/src/shell.rs: captures ignored-on-entry signals inShell::new.brush-builtins/src/trap.rs:trap -pandtrap -p <sig>report ignored-on-entry signals astrap -- '' <SIG>.Validation
SIGRTMIN(replicating the CI environment): 2174 test cases, 0 failed (the previously-failingtrap -p - with no args shows all trapscase now passes).cargo clippyandcargo fmt --checkclean; brush-core unit tests pass.Fixes the CI failure seen on the OS-target test jobs in e.g. #1267.