From bcd78c3940a05c13b64257bf0944567d109561c7 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 13 Sep 2022 07:51:32 +0530 Subject: [PATCH] Fix a regression that caused kitty not to restore SIGPIPE after python nukes it when launching children. Affects bash which does not sanitize its signal mask. Fixes #5500 --- docs/changelog.rst | 2 ++ kitty/child.c | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/docs/changelog.rst b/docs/changelog.rst index 083f2f6aa..322c86fec 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -55,6 +55,8 @@ Detailed list of changes - Wayland: Generate a XDG_ACTIVATION_TOKEN when opening URLs or running programs in the background via the launch action +- Fix a regression that caused kitty not to restore SIGPIPE after python nukes it when launching children. Affects bash which does not sanitize its signal mask. (:iss:`5500`) + 0.26.2 [2022-09-05] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/kitty/child.c b/kitty/child.c index 228bbcc51..27e5dc4a5 100644 --- a/kitty/child.c +++ b/kitty/child.c @@ -100,11 +100,14 @@ spawn(PyObject *self UNUSED, PyObject *args) { #if PY_VERSION_HEX >= 0x03070000 PyOS_AfterFork_Child(); #endif - // See _Py_RestoreSignals in signalmodule.c for a list of signals python nukes const struct sigaction act = {.sa_handler=SIG_DFL}; #define SA(which) if (sigaction(which, &act, NULL) != 0) exit_on_err("sigaction() in child process failed"); for (int si = 0; si < num_handled_signals; si++) { SA(handled_signals[si]); } + // See _Py_RestoreSignals in signalmodule.c for a list of signals python nukes +#ifdef SIGPIPE + SA(SIGPIPE) +#endif #ifdef SIGXFSZ SA(SIGXFSZ); #endif