dnf/get-lockfile-exists-before-unlick.patch

30 lines
874 B
Diff
Raw Permalink Normal View History

2023-02-22 00:25:35 +08:00
From a569c1cd79d225f928e00b5ab3e0084ddaa41334 Mon Sep 17 00:00:00 2001
From: small_leek <xiasenlin1@huawei.com>
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