chantra / rpms / rpm

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