richardphibel / rpms / rpm

Forked from rpms/rpm 2 years ago
Clone
b445f2
From cb6aa82dbc10d554f8d234e934ae7c77e39a3ce2 Mon Sep 17 00:00:00 2001
b445f2
From: Panu Matilainen <pmatilai@redhat.com>
b445f2
Date: Tue, 12 Jan 2021 13:35:23 +0200
b445f2
Subject: [PATCH] Unblock signals in forked scriptlets
b445f2
b445f2
Since commit c5f82d3f6223ebd0c5cc0a07ea60393ae7284929 we've blocked
b445f2
most signals during transactions, which makes sense to rpm itself but
b445f2
the signal mask is inherited to childs and carried even across exec(),
b445f2
so all scriptlets are executing with those signals blocked as well.
b445f2
Which in turn does not make sense, the scriptlets could run stuff that
b445f2
actually depends on signal delivery (such as SIGALARM in RhBug:1913765).
b445f2
b445f2
Unblock all signals for forked scriptlet execution (Lua scriptlets are
b445f2
totally different as they execute in-process for now)
b445f2
---
b445f2
 lib/rpmscript.c | 5 +++++
b445f2
 1 file changed, 5 insertions(+)
b445f2
b445f2
diff --git a/lib/rpmscript.c b/lib/rpmscript.c
b445f2
index 2ae3378f7..c69d29554 100644
b445f2
--- a/lib/rpmscript.c
b445f2
+++ b/lib/rpmscript.c
b445f2
@@ -152,6 +152,11 @@ static void doScriptExec(ARGV_const_t argv, ARGV_const_t prefixes,
b445f2
 			FD_t scriptFd, FD_t out)
b445f2
 {
b445f2
     int xx;
b445f2
+    sigset_t set;
b445f2
+
b445f2
+    /* Unmask all signals, the scripts may need them */
b445f2
+    sigfillset(&set);
b445f2
+    sigprocmask(SIG_UNBLOCK, &set, NULL);
b445f2
 
b445f2
     /* SIGPIPE is ignored in rpm, reset to default for the scriptlet */
b445f2
     (void) signal(SIGPIPE, SIG_DFL);
b445f2
-- 
b445f2
2.29.2
b445f2