Repository navigation
Conversation
bash 5.3 runs pending traps between commands inside a running trap handler, so a SIGHUP arriving while exit_screensaver runs re-entered it from inside itself once per further signal, recursing until the stack overflowed (seen as a SIGSEGV mid-dismiss, 4,800 nested handler frames in the core). Ignore the exit signals at the top of the handler so any burst still ends in a single clean exit. Fixes omacom#16807
[Low impact] The PR appears safe to merge, with no outstanding findings. Summary
Reviews (2) · Last reviewed commit: "Fold the screensaver SIGHUP re-entry tes..." · Reviewed by Greptile |
The re-entry case lived in its own file with a separate stub setup; it now runs as the last section of screensaver-workspace-test.sh, reusing that file's stubs and assertion style so screensaver coverage stays in one file.
|
This makes the same change as #9042 by @PyRo1121, opened on August 30 and still open: both add There is a second reason neither can land on What was checked: both diffs side by side, the history of Thank you @AnPod for the careful reproduction. If this does something #9042 does not, reopen it with a note on the difference. |
Fixes #16807
Problem
omarchy-screensavercan die with SIGSEGV while being dismissed. The reporter's core shows a stack overflow:exit_screensavernested ~4,800 deep, every level handling a SIGHUP.exit_screensaveris the trap handler for SIGINT/SIGTERM/SIGHUP/SIGQUIT and neither disables those traps nor guards against re-entry. Since bash 5.3, pending traps run between commands inside a running trap handler, so every signal that arrives beforeexit 0starts a nestedexit_screensaver. During a burst (monitor churn, PipeWire restart, or the handler's ownpkilltaking down its terminal), the nesting runs away until the stack probe faults.Fix
bin/omarchy-screensaver: the first statement ofexit_screensavernow ignores the exit signals (trap '' SIGINT SIGTERM SIGHUP SIGQUIT), so any burst of signals still ends in the one clean exit already in progress.Test
A new case in
test/shell.d/screensaver-workspace-test.shruns the real script with stubbedhyprctl/ttfx/pgrep, where the handler's ownhyprctlcall sends the script a SIGHUP mid-handler — the feedback path from the report.The existing screensaver/idle tests (
idle-test.sh,screensaver-workspace-test.sh,shell-idle-spawn-test.sh) still pass.