richardphibel / rpms / rpm

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