dcavalca / rpms / rpm

Forked from rpms/rpm 2 years ago
Clone

Blame SOURCES/0001-Unblock-signals-in-forked-scriptlets.patch

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