From 200ed9be1bf1581097d69e958db8c9acff72e735 Mon Sep 17 00:00:00 2001 From: Jan Kolarik Date: Mon, 28 Aug 2023 14:34:51 +0000 Subject: [PATCH 1/2] Block signals during RPM transaction processing Prevent signals to interrupt the processing of the RPM transaction inside the DNF. This was originally committed in db833ff, but reverted later in 969781d as the provided API wasn't available on some systems rebasing from upstream which is not the case anymore. Resolves https://issues.redhat.com/browse/RHEL-1235. --- dnf/base.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/dnf/base.py b/dnf/base.py index 7e97e21298..ff7c6fe77e 100644 --- a/dnf/base.py +++ b/dnf/base.py @@ -1028,6 +1028,9 @@ def do_transaction(self, display=()): for display_ in cb.displays: display_.output = False + # block signals to disallow external interruptions of the transaction + rpm.blockSignals(True) + self._plugins.run_pre_transaction() logger.info(_('Running transaction')) @@ -1045,6 +1048,9 @@ def _pto_callback(action, tsis): for msg in dnf.util._post_transaction_output(self, self.transaction, _pto_callback): logger.debug(msg) + # unblock signals as we are done with the transaction + rpm.blockSignals(False) + return tid def _trans_error_summary(self, errstring): From 3134f5d7dec43dcaab18c4d144c03f35ec7f5a8b Mon Sep 17 00:00:00 2001 From: Jan Kolarik Date: Thu, 31 Aug 2023 08:42:53 +0000 Subject: [PATCH 2/2] Bump rpm version to 4.18.0 We are using the `rpm.blockSignals()` around RPM transactions to prevent interrupting them from outside. With rpm < 4.18.0, unblocking signals via this API caused termination on `SIGPIPE` signal which is unwanted as we have an overridden handler for this signal in DNF. With rpm >= 4.18.0 this is not happening anymore, therefore bumping the version. --- dnf.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dnf.spec b/dnf.spec index d7925b31de..790bf26f59 100644 --- a/dnf.spec +++ b/dnf.spec @@ -5,7 +5,7 @@ %global hawkey_version 0.66.0 %global libcomps_version 0.1.8 %global libmodulemd_version 2.9.3 -%global rpm_version 4.14.0 +%global rpm_version 4.18.0 # conflicts %global conflicts_dnf_plugins_core_version 4.0.26