From 405261dd10c2a8204a4041aa8d2d8b4878e6e1ec Mon Sep 17 00:00:00 2001 From: small_leek Date: Wed, 22 Feb 2023 00:25:35 +0800 Subject: [PATCH] Add exception capture --- dnf.spec | 5 ++- get-lockfile-exists-before-unlick.patch | 53 ++++++++++++++----------- 2 files changed, 33 insertions(+), 25 deletions(-) diff --git a/dnf.spec b/dnf.spec index b965f99..1850a73 100644 --- a/dnf.spec +++ b/dnf.spec @@ -3,7 +3,7 @@ Name: dnf Version: 4.14.0 -Release: 10 +Release: 11 Summary: A software package manager that manages packages on Linux distributions. License: GPLv2+ and GPLv2 and GPL URL: https://github.com/rpm-software-management/dnf @@ -252,6 +252,9 @@ popd %{_mandir}/man8/%{name}-automatic.8* %changelog +* Wed Feb 22 2023 xiasenlin - 4.14.0-11 +- DESC:Add exception capture to get-lockfile-exists-before-unlick.patch + * Fri Feb 17 2023 chenhaixing 4.14.0-10 - Type:bugfix - CVE:NA diff --git a/get-lockfile-exists-before-unlick.patch b/get-lockfile-exists-before-unlick.patch index ead5c8c..246aea7 100644 --- a/get-lockfile-exists-before-unlick.patch +++ b/get-lockfile-exists-before-unlick.patch @@ -1,24 +1,29 @@ -From 5cf9fbe5096c807668da3c1685c917996b91c960 Mon Sep 17 00:00:00 2001 -From: Duan Pengjie -Date: Wed, 4 Jan 2023 11:51:23 +0800 -Subject: [PATCH] add exists - ---- - dnf/lock.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/dnf/lock.py b/dnf/lock.py -index ee7a0db..a94132a 100644 ---- a/dnf/lock.py -+++ b/dnf/lock.py -@@ -161,6 +161,6 @@ class ProcessLock(object): - pid = self._try_lock(my_pid) - - def __exit__(self, *exc_args): -- if self.count == 1: -+ if self.count == 1 and os.path.exists(self.target): - os.unlink(self.target) - self._unlock_thread() --- -2.37.1 (Apple Git-137.1) - +From a569c1cd79d225f928e00b5ab3e0084ddaa41334 Mon Sep 17 00:00:00 2001 +From: small_leek +Date: Tue, 21 Feb 2023 20:29:39 +0800 +Subject: [PATCH] add patch + +--- + dnf/lock.py | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +diff --git a/dnf/lock.py b/dnf/lock.py +index ee7a0db..851030e 100644 +--- a/dnf/lock.py ++++ b/dnf/lock.py +@@ -161,6 +161,10 @@ class ProcessLock(object): + pid = self._try_lock(my_pid) + + def __exit__(self, *exc_args): +- if self.count == 1: +- os.unlink(self.target) ++ if self.count == 1 and os.path.exists(self.target): ++ try: ++ os.unlink(self.target) ++ except FileNotFoundError as err: ++ msg = _('No %s existed, please check!') % (self.target) ++ logger.warning(msg) + self._unlock_thread() +-- +2.33.0 +