!286 Fix regression on ctrl-c during transaction killing scriptlets

From: @renxichen 
Reviewed-by: @xujing99 
Signed-off-by: @xujing99
This commit is contained in:
openeuler-ci-bot 2023-12-14 06:16:38 +00:00 committed by Gitee
commit 3af0bf4f86
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 41 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.17.0
Release: 31
Release: 32
Summary: RPM Package Manager
License: GPLv2+
URL: http://www.rpm.org/
@ -113,6 +113,7 @@ Patch6074: backport-Fix-possible-null-pointer-reference-in-ndb.patch
Patch6075: backport-Fix-rpmDigestBundleFinal-and-Update-return-code-on-i.patch
Patch6076: backport-Actually-return-an-error-in-parseScript-if-parsing-f.patch
Patch6077: backport-Check-inside-root-when-querying-for-files.patch
Patch6078: backport-Fix-regression-on-ctrl-c-during-transaction-killing-.patch
BuildRequires: gcc autoconf automake libtool make gawk popt-devel openssl-devel readline-devel
BuildRequires: zlib-devel zstd-devel >= 1.3.8 xz-devel bzip2-devel libarchive-devel ima-evm-utils-devel
@ -403,6 +404,9 @@ make check || (cat tests/rpmtests.log; exit 0)
%{_mandir}/man1/gendiff.1*
%changelog
* Thu Dec 14 2023 renhongxun<renhongxun@h-partners.com> - 4.17.0-32
- Fix regression on ctrl-c during transaction killing scriptlets
* Tue Sep 26 2023 renhongxun<renhongxun@h-partners.com> - 4.17.0-31
- Fix potential segmentation fault