Fix regression on ctrl-c during transaction killing scriptlets

This commit is contained in:
renxichen 2022-11-15 14:51:56 +08:00
parent 334c727561
commit ca678ee9c3
2 changed files with 44 additions and 1 deletions

View File

@ -0,0 +1,36 @@
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

View File

@ -1,6 +1,6 @@
Name: rpm
Version: 4.15.1
Release: 41
Release: 42
Summary: RPM Package Manager
License: GPLv2+
URL: http://www.rpm.org/
@ -183,6 +183,7 @@ Patch163: backport-rpm2cpio.sh-Don-t-drop-newlines-from-header-sizes.patch
Patch164: backport-rpm2cpio.sh-strip-null-bytes-with-tr.patch
Patch165: backport-rpm2cpio.sh-only-read-needed-bytes-of-file-magic.patch
Patch166: backport-Unblock-signals-in-forked-scriptlets.patch
Patch167: backport-Fix-regression-on-ctrl-c-during-transaction-killing-.patch
BuildRequires: gcc autoconf automake libtool make gawk popt-devel openssl-devel readline-devel libdb-devel
BuildRequires: zlib-devel libzstd-devel xz-devel bzip2-devel libarchive-devel ima-evm-utils-devel
@ -466,6 +467,12 @@ make check || (cat tests/rpmtests.log; exit 0)
%{_mandir}/man1/gendiff.1*
%changelog
* Tue Nov 15 2022 renhongxun<renhongxun@h-partners.com> - 4.15.1-42
- Type:bugfix
- ID:NA
- SUG:NA
- DESC:Fix regression on ctrl-c during transaction killing scriptlets
* Mon Nov 14 2022 Chen Xiao<chenx1@wangsu.com> - 4.15.1-41
- Type:bugfix
- ID:NA