rpm/backport-Fix-regression-on-ctrl-c-during-transaction-killing-.patch

37 lines
1.2 KiB
Diff

From 25c4c61a9599590ce4d610621ff0bffde7ae5e82 Mon Sep 17 00:00:00 2001
From: Panu Matilainen <pmatilai@redhat.com>
Date: Thu, 3 Mar 2022 10:31:28 +0200
Subject: [PATCH] Fix regression on ctrl-c during transaction killing
scriptlets
Commit cb6aa82dbc10d554f8d234e934ae7c77e39a3ce2 unblocked all signals
from scriptlets, but turns out this is too much: SIGINT, SIGTSTP and
SIGQUIT sent from the terminal are passed to the process group, and
with unblocked signals end up killing our scriptlets while rpm itself
continues. -ENOSENSE.
Stopping (and continuing) is okay though so we don't block that.
---
lib/rpmscript.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/lib/rpmscript.c b/lib/rpmscript.c
index e123916a9..3d6f3a72c 100644
--- a/lib/rpmscript.c
+++ b/lib/rpmscript.c
@@ -197,8 +197,10 @@ static void doScriptExec(ARGV_const_t argv, ARGV_const_t prefixes,
int xx;
sigset_t set;
- /* Unmask all signals, the scripts may need them */
+ /* Unmask most signals, the scripts may need them */
sigfillset(&set);
+ sigdelset(&set, SIGINT);
+ sigdelset(&set, SIGQUIT);
sigprocmask(SIG_UNBLOCK, &set, NULL);
/* SIGPIPE is ignored in rpm, reset to default for the scriptlet */
--
2.27.0