servers: fix to reverse SA_RESTART option for sigaction() on modern codepath - #22037
servers: fix to reverse SA_RESTART option for sigaction() on modern codepath#22037vszakats wants to merge 6 commits into
SA_RESTART option for sigaction() on modern codepath#22037Conversation
This comment was marked as outdated.
This comment was marked as outdated.
SA_RESTART option
SA_RESTART optionSA_RESTART option
SA_RESTART optionSA_RESTART option on the modern, sigaction() codepath
SA_RESTART option on the modern, sigaction() codepathSA_RESTART option for sigaction() on modern codepath
SA_RESTART option for sigaction() on modern codepathSA_RESTART option for sigaction(), on modern codepath
There was a problem hiding this comment.
Pull request overview
This PR fixes a long-standing behavioral mismatch in the curl test server signal handling: the modern sigaction() path had SA_RESTART behavior reversed relative to the historical siginterrupt() semantics, and this change restores the original meaning of the flag.
Changes:
- Reverse
SA_RESTARThandling inset_signal()when usingsigaction()so it matches the legacysiginterrupt()behavior.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
I plan to merge this as-is, soon, then try yanking the signal handling in |
|
augment review |
This reverts commit 599bd627394e860d294d40e78de623ae5106bbc9.
This reverts commit 5fb79fb56786daa848cf3825a16f053ae17c0d78.
This reverts commit a58c282a15f4238e91425592c09fa6f79e1e292a.
SA_RESTART option for sigaction(), on modern codepathSA_RESTART option for sigaction() on modern codepath
|
augment review |
🤖 Augment PR SummarySummary: This PR fixes the inverted restart behavior for server signal handlers on the modern Changes:
Technical Notes: The intent is to keep 🤖 Was this summary useful? React with 👍 or 👎 |
|
Well, this may not be the last word said about signals and restart behavior. Just spotted this commit: Which sets SIGARLM, to the reverse of how it's set later on. Quite confusing. |
Historically servers used the deprecated
siginterrupt()function toconfigure restart behavior on specific signals. It accepts a flag, where
1 means to remove the
SA_RESTARToption, and 0 means to enable it.In year 2021 3fb6e5a introduced the
modern alternative to the codebase, replacing
siginterrupt()withsigaction(). After this patch, supporting, modern, systems reacted onthe same flag, but, by accident, set the
SA_RESTARTbit when flag is1, and did not set it when 0. This reversed the previous behavior, and
the one still used on the
siginterrupt()legacy codepath.Fix it by reversing the
SA_RESTARTlogic for thesigaction()codepath, syncing it with the pre-existing behavior.
I find it odd this did not cause any perceivable issue for 5 years, even
though it's the active one in most Unix envs.
Spotted by GitHub Code Quality, though suggesting to fix
siginterrupt()calls. But looking into the history, those were correctall along.
Refs:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/siginterrupt.html
https://pubs.opengroup.org/onlinepubs/9699919799/functions/sigaction.html
https://www.man7.org/linux/man-pages/man3/siginterrupt.3.html
https://www.man7.org/linux/man-pages/man2/sigaction.2.html
Follow-up to 3fb6e5a #6529