Repository navigation
[4.0.2] Disarm screensaver signal traps before cleanup - #9196
Closed
ryanrhughes wants to merge 2 commits into
Closed
ryanrhughes wants to merge 2 commits into
ryanrhughes wants to merge 2 commits into
Conversation
exit_screensaver closes the terminal that owns this script's own pty, and bash re-enters a trap for the signal it is already handling, so every hangup that teardown sends back nests the handler one level deeper until the stack is gone. Disarming as the function's first statement is one command too late, because bash can re-enter at the call boundary before the body starts. Driving the real script from a pty on an Omarchy 4.0.1-1 worker under a sustained hangup, eight runs each: the shipped handler segfaulted 8 times, disarming inside the function 2, and disarming as the trap's own first command 0. trap : rather than trap '' because an ignored disposition survives exec, which would leave the hyprctl and pkill children immune to SIGTERM too. Co-Authored-By: Codex GPT-5.6 <codex@openai.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
Why
omarchy-screensavercan recursively re-enter its SIGHUP handler during terminal teardown until Bash exhausts its stack and segfaults. Installing the no-op traps in the trap command itself closes the pre-function call boundary; installing them at the top ofexit_screensaveralso protects direct cleanup calls.This uses
trap :rather than an ignored disposition so commands launched during cleanup remain responsive to signals.Fixes #8386.
Verification
test/shell.d/screensaver-signal-test.shpasses for signal-triggered and input-triggered cleanupv4-0-2tree at the cleanup re-entry assertion./test/clipasses./test/allreaches and passes the new test; its five unrelated failures reproduce unchanged on pristineorigin/v4-0-2(three require a localomarchy-pkgscheckout, one is the existing theme guard environment leak, and one is the existing live two-monitor IPC duplication)bash -nandgit diff --checkpass