dnf:remove patch about pidfile
This commit is contained in:
parent
a574a2343e
commit
ca82c61220
@ -1,25 +0,0 @@
|
|||||||
From 997310fff83c3701ffc5c3835979732b130679c0 Mon Sep 17 00:00:00 2001
|
|
||||||
From: zhangrui <zhangrui182@huawei.com>
|
|
||||||
Date: Wed, 29 Dec 2021 14:59:18 +0800
|
|
||||||
Subject: [PATCH] adapt-test-another-process
|
|
||||||
|
|
||||||
---
|
|
||||||
tests/test_lock.py | 2 +-
|
|
||||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/tests/test_lock.py b/tests/test_lock.py
|
|
||||||
index ce9806b..c075005 100644
|
|
||||||
--- a/tests/test_lock.py
|
|
||||||
+++ b/tests/test_lock.py
|
|
||||||
@@ -112,7 +112,7 @@ class ProcessLockTest(tests.support.TestCase):
|
|
||||||
with l1:
|
|
||||||
process.start()
|
|
||||||
process.join()
|
|
||||||
- self.assertIsInstance(process.queue.get(), ProcessLockError)
|
|
||||||
+ self.assertEqual(process.queue.empty(), True)
|
|
||||||
|
|
||||||
def test_another_process_blocking(self):
|
|
||||||
l1 = build_lock(blocking=True)
|
|
||||||
--
|
|
||||||
2.27.0
|
|
||||||
|
|
||||||
12
dnf.spec
12
dnf.spec
@ -3,18 +3,14 @@
|
|||||||
|
|
||||||
Name: dnf
|
Name: dnf
|
||||||
Version: 4.14.0
|
Version: 4.14.0
|
||||||
Release: 14
|
Release: 15
|
||||||
Summary: A software package manager that manages packages on Linux distributions.
|
Summary: A software package manager that manages packages on Linux distributions.
|
||||||
License: GPLv2+ and GPLv2 and GPL
|
License: GPLv2+ and GPLv2 and GPL
|
||||||
URL: https://github.com/rpm-software-management/dnf
|
URL: https://github.com/rpm-software-management/dnf
|
||||||
Source0: https://github.com/rpm-software-management/dnf/archive/%{version}/%{name}-%{version}.tar.gz
|
Source0: https://github.com/rpm-software-management/dnf/archive/%{version}/%{name}-%{version}.tar.gz
|
||||||
|
|
||||||
Patch9000: unlock-pidfile-if-current-proccess-is-NOT-dnf.patch
|
|
||||||
Patch9001: fix-pid-file-residue.patch
|
|
||||||
Patch9002: add-rpm-transaction-debuginfo.patch
|
Patch9002: add-rpm-transaction-debuginfo.patch
|
||||||
Patch9003: adapt-test-another-process.patch
|
|
||||||
Patch9004: fix-dnf-history-undo-error-when-history-sqlite-missing.patch
|
Patch9004: fix-dnf-history-undo-error-when-history-sqlite-missing.patch
|
||||||
Patch9005: huawei-lock-file-add-verify-parameter.patch
|
|
||||||
|
|
||||||
%if 0%{?check_target_before_unlink}
|
%if 0%{?check_target_before_unlink}
|
||||||
Patch9006: get-lockfile-exists-before-unlick.patch
|
Patch9006: get-lockfile-exists-before-unlick.patch
|
||||||
@ -256,6 +252,12 @@ popd
|
|||||||
%{_mandir}/man8/%{name}-automatic.8*
|
%{_mandir}/man8/%{name}-automatic.8*
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Fri Jul 14 2023 chenhaixing <chenhaixing@huawei.com> - 4.14.0-15
|
||||||
|
- Type:bugfix
|
||||||
|
- CVE:NA
|
||||||
|
- SUG:NA
|
||||||
|
- DESC:dnf:remove patch about pidfile
|
||||||
|
|
||||||
* Tue Jun 27 2023 chenhaixing <chenhaixing@huawei.com> - 4.14.0-14
|
* Tue Jun 27 2023 chenhaixing <chenhaixing@huawei.com> - 4.14.0-14
|
||||||
- Type:bugfix
|
- Type:bugfix
|
||||||
- CVE:NA
|
- CVE:NA
|
||||||
|
|||||||
@ -1,50 +0,0 @@
|
|||||||
From 0dfb26f901976a585ed29585d5cae694a11360d7 Mon Sep 17 00:00:00 2001
|
|
||||||
From: zhangrui <zhangrui182@huawei.com>
|
|
||||||
Dare: Mon, 21 Feb 2022 11:18:06 +0800
|
|
||||||
Subject: [PATCH] fix-pid-file-residue
|
|
||||||
|
|
||||||
---
|
|
||||||
dnf/lock.py | 25 ++++++++++++-------------
|
|
||||||
1 file changed, 12 insertions(+), 13 deletions(-)
|
|
||||||
|
|
||||||
diff -urNp a/dnf/lock.py b/dnf/lock.py
|
|
||||||
--- a/dnf/lock.py 2020-07-14 20:33:25.746000000 +0800
|
|
||||||
+++ b/dnf/lock.py 2020-07-14 20:51:17.378000000 +0800
|
|
||||||
@@ -108,26 +108,25 @@ class ProcessLock(object):
|
|
||||||
# already locked by this process
|
|
||||||
return pid
|
|
||||||
|
|
||||||
+ if not os.access('/proc/%d/stat' % old_pid, os.F_OK):
|
|
||||||
+ # locked by a dead process, write our pid
|
|
||||||
+ os.lseek(fd, 0, os.SEEK_SET)
|
|
||||||
+ os.ftruncate(fd, 0)
|
|
||||||
+ os.write(fd, str(pid).encode('utf-8'))
|
|
||||||
+ return pid
|
|
||||||
+
|
|
||||||
try:
|
|
||||||
with open('/proc/%d/status' % old_pid) as f:
|
|
||||||
- for line in f:
|
|
||||||
- if not re.match(r'Name:(.*)(dnf|yum)$', line, re.I):
|
|
||||||
- os.write(fd, str(pid).encode('utf-8'))
|
|
||||||
- return pid
|
|
||||||
- except Exception as e:
|
|
||||||
+ if not re.findall(r'Name:(.*)(dnf|yum)', f.read(), re.I):
|
|
||||||
+ os.write(fd, str(pid).encode('utf-8'))
|
|
||||||
+ return pid
|
|
||||||
+ except OSError as e:
|
|
||||||
msg = _('Malformed lock file found: %s.\n'
|
|
||||||
'But pid in lock file is invalid '
|
|
||||||
'Ensure no other dnf/yum process is running and '
|
|
||||||
'remove the lock file manually.') % (self.target)
|
|
||||||
raise LockError(msg)
|
|
||||||
|
|
||||||
- if not os.access('/proc/%d/stat' % old_pid, os.F_OK):
|
|
||||||
- # locked by a dead process, write our pid
|
|
||||||
- os.lseek(fd, 0, os.SEEK_SET)
|
|
||||||
- os.ftruncate(fd, 0)
|
|
||||||
- os.write(fd, str(pid).encode('utf-8'))
|
|
||||||
- return pid
|
|
||||||
-
|
|
||||||
return old_pid
|
|
||||||
|
|
||||||
finally:
|
|
||||||
@ -1,29 +0,0 @@
|
|||||||
From ec8644e42ec2e0d0f98ea1aee3859b2c510f0cc0 Mon Sep 17 00:00:00 2001
|
|
||||||
From: chenhaixing <chenhaixing@huawei.com>
|
|
||||||
Date: Sat, 4 Jun 2022 17:49:53 +0800
|
|
||||||
Subject: [PATCH] verify-parameter
|
|
||||||
|
|
||||||
---
|
|
||||||
dnf/lock.py | 7 ++++++-
|
|
||||||
1 file changed, 6 insertions(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/dnf/lock.py b/dnf/lock.py
|
|
||||||
index ab05a3b..12378ec 100644
|
|
||||||
--- a/dnf/lock.py
|
|
||||||
+++ b/dnf/lock.py
|
|
||||||
@@ -116,7 +116,12 @@ class ProcessLock(object):
|
|
||||||
return pid
|
|
||||||
|
|
||||||
try:
|
|
||||||
- with open('/proc/%d/status' % old_pid) as f:
|
|
||||||
+ old_pid_path = f'/proc/{old_pid}/status'
|
|
||||||
+ true_old_pid_path = os.path.realpath(old_pid_path)
|
|
||||||
+ if not true_old_pid_path.startswith("/proc/"):
|
|
||||||
+ return old_pid
|
|
||||||
+
|
|
||||||
+ with open(true_old_pid_path) as f:
|
|
||||||
if not re.findall(r'Name:(.*)(dnf|yum)', f.read(), re.I):
|
|
||||||
os.write(fd, str(pid).encode('utf-8'))
|
|
||||||
return pid
|
|
||||||
--
|
|
||||||
2.27.0
|
|
||||||
@ -1,44 +0,0 @@
|
|||||||
From 7438ca37b6e688637a87cbdc87490e70a61e1829 Mon Sep 17 00:00:00 2001
|
|
||||||
From: fengtao40 <fengtao40@huawei.com>
|
|
||||||
Date: Sat, 13 Jun 2020 16:54:09 +0800
|
|
||||||
Subject: [PATCH] unlock-pidfile-if-current-proccess-is-NOT-dnf
|
|
||||||
|
|
||||||
---
|
|
||||||
dnf/lock.py | 14 ++++++++++++++
|
|
||||||
1 file changed, 14 insertions(+)
|
|
||||||
|
|
||||||
diff --git a/dnf/lock.py b/dnf/lock.py
|
|
||||||
index 13d8c27..589aa0a 100644
|
|
||||||
--- a/dnf/lock.py
|
|
||||||
+++ b/dnf/lock.py
|
|
||||||
@@ -32,6 +32,7 @@ import logging
|
|
||||||
import os
|
|
||||||
import threading
|
|
||||||
import time
|
|
||||||
+import re
|
|
||||||
|
|
||||||
logger = logging.getLogger("dnf")
|
|
||||||
|
|
||||||
@@ -106,6 +107,19 @@ class ProcessLock(object):
|
|
||||||
if old_pid == pid:
|
|
||||||
# already locked by this process
|
|
||||||
return pid
|
|
||||||
+
|
|
||||||
+ try:
|
|
||||||
+ with open('/proc/%d/status' % old_pid) as f:
|
|
||||||
+ for line in f:
|
|
||||||
+ if not re.match(r'Name:(.*)(dnf|yum)$', line, re.I):
|
|
||||||
+ os.write(fd, str(pid).encode('utf-8'))
|
|
||||||
+ return pid
|
|
||||||
+ except Exception as e:
|
|
||||||
+ msg = _('Malformed lock file found: %s.\n'
|
|
||||||
+ 'But pid in lock file is invalid '
|
|
||||||
+ 'Ensure no other dnf/yum process is running and '
|
|
||||||
+ 'remove the lock file manually.') % (self.target)
|
|
||||||
+ raise LockError(msg)
|
|
||||||
|
|
||||||
if not os.access('/proc/%d/stat' % old_pid, os.F_OK):
|
|
||||||
# locked by a dead process, write our pid
|
|
||||||
--
|
|
||||||
2.18.2
|
|
||||||
|
|
||||||
Loading…
x
Reference in New Issue
Block a user