Skip to contentSkip to conversation

dnf: remove log_lock.pid before exit

PATCH Superseded [email protected] 3 participants 4 messages Mar 7, 2024

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dnf: remove log_lock.pid before exit

From: Changqing Li <[email protected]>

dnf has a bug, refer [1], it causes that log_lock.pid may not removed after dnf exit. And for native dnf, since we change the lock file path to /, it will never be removed, and make the rootfs not clean,refer [2][3]. This patch is a workaround to fix above issue.

[1] https://github.com/rpm-software-management/dnf/issues/1963
[2] https://git.openembedded.org/openembedded-core/commit/?id=742a1b71249f4da1c8d8e13e270b0eb6128a3f66
[3] https://github.com/rpm-software-management/dnf/blob/master/etc/tmpfiles.d/dnf.conf

---
 ...n.py-remove-log_lock.pid-before-exit.patch | 41 +++++++++++++++++++
 meta/recipes-devtools/dnf/dnf_4.18.2.bb       |  3 +-
 2 files changed, 43 insertions(+), 1 deletion(-)
 create mode 100644 meta/recipes-devtools/dnf/dnf/0001-main.py-remove-log_lock.pid-before-exit.patch
meta/recipes-devtools/dnf/dnf/0001-main.py-remove-log_lock.pid-before-exit.patch new file +41 -0
new file mode 100644
index 0000000000..ae036cbbd6
@@ -0,0 +1,41 @@
+From bdf17281385cf33ad59267fe75a9e427e6e2ffc4 Mon Sep 17 00:00:00 2001
+From: Changqing Li <[email protected]>
+Date: Thu, 7 Mar 2024 14:03:07 +0800
+Subject: [PATCH] main.py: remove log_lock.pid before exit
+
+dnf has a bug, refer [1], it causes that log_lock.pid may not removed
+after dnf exit. And for native dnf, since we change the lock file path
+to /, it will never be removed, and make the rootfs not clean,refer
+[2][3].  This patch is a workaround to fix above issue.
+
+[1] https://github.com/rpm-software-management/dnf/issues/1963
+[2] https://git.openembedded.org/openembedded-core/commit/?id=742a1b71249f4da1c8d8e13e270b0eb6128a3f66
+[3] https://github.com/rpm-software-management/dnf/blob/master/etc/tmpfiles.d/dnf.conf
+
+Upstream-Status: Submited [ report to https://github.com/rpm-software-management/dnf/issues/1963]
+
+Signed-off-by: Changqing Li <[email protected]>
+---
+ dnf/cli/main.py | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+diff --git a/dnf/cli/main.py b/dnf/cli/main.py
+index 2a7f92d54..2f672cff2 100644
+--- a/dnf/cli/main.py
++++ b/dnf/cli/main.py
+@@ -200,6 +200,12 @@ def user_main(args, exit_code=False):
+ 
+     errcode = main(args)
+     if exit_code:
++        for arg in args:
++            if arg.startswith("--installroot="):
++                root=arg.split("=")[1]
++                if os.path.exists(os.path.join(root, "log_lock.pid")):
++                    os.unlink(os.path.join(root, "log_lock.pid"))
++                break
+         sys.exit(errcode)
+     return errcode
+ 
+-- 
+2.25.1
+
meta/recipes-devtools/dnf/dnf_4.18.2.bb +2 -1
index dc0c18be5e..7770c9d7e0 100644
@@ -17,7 +17,8 @@ SRC_URI = "git://github.com/rpm-software-management/dnf.git;branch=master;protoc
            file://0001-set-python-path-for-completion_helper.patch \
            "
 
-SRC_URI:append:class-native = "file://0001-dnf-write-the-log-lock-to-root.patch"
+SRC_URI:append:class-native = "file://0001-dnf-write-the-log-lock-to-root.patch \
+                               file://0001-main.py-remove-log_lock.pid-before-exit.patch"
 
 SRCREV = "1c43d0999178d492381ad0b43917ffd9c74016f8"
 UPSTREAM_CHECK_GITTAGREGEX = "(?P<pver>\d+(\.\d+)+)"
Signature · 1 line
2.25.1
#1 lore raw

Patchtest results for [PATCH] dnf: remove log_lock.pid before exit

Thank you for your submission. Patchtest identified one or more issues with the patch. Please see the log below for more information:

---
Testing patch /home/patchtest/share/mboxes/dnf-remove-log_lock.pid-before-exit.patch

FAIL: test Upstream-Status presence: Upstream-Status is in incorrect format (test_patch.TestPatch.test_upstream_status_presence_format)

PASS: pretest src uri left files (test_metadata.TestMetadata.pretest_src_uri_left_files)
PASS: test CVE check ignore (test_metadata.TestMetadata.test_cve_check_ignore)
PASS: test CVE tag format (test_patch.TestPatch.test_cve_tag_format)
PASS: test Signed-off-by presence (test_mbox.TestMbox.test_signed_off_by_presence)
PASS: test Signed-off-by presence (test_patch.TestPatch.test_signed_off_by_presence)
PASS: test author valid (test_mbox.TestMbox.test_author_valid)
PASS: test commit message presence (test_mbox.TestMbox.test_commit_message_presence)
PASS: test lic files chksum modified not mentioned (test_metadata.TestMetadata.test_lic_files_chksum_modified_not_mentioned)
PASS: test max line length (test_metadata.TestMetadata.test_max_line_length)
PASS: test mbox format (test_mbox.TestMbox.test_mbox_format)
PASS: test non-AUH upgrade (test_mbox.TestMbox.test_non_auh_upgrade)
PASS: test shortlog format (test_mbox.TestMbox.test_shortlog_format)
PASS: test shortlog length (test_mbox.TestMbox.test_shortlog_length)
PASS: test src uri left files (test_metadata.TestMetadata.test_src_uri_left_files)

SKIP: pretest pylint: No python related patches, skipping test (test_python_pylint.PyLint.pretest_pylint)
SKIP: test bugzilla entry format: No bug ID found (test_mbox.TestMbox.test_bugzilla_entry_format)
SKIP: test lic files chksum presence: No added recipes, skipping test (test_metadata.TestMetadata.test_lic_files_chksum_presence)
SKIP: test license presence: No added recipes, skipping test (test_metadata.TestMetadata.test_license_presence)
SKIP: test pylint: No python related patches, skipping test (test_python_pylint.PyLint.test_pylint)
SKIP: test series merge on head: Merge test is disabled for now (test_mbox.TestMbox.test_series_merge_on_head)
SKIP: test summary presence: No added recipes, skipping test (test_metadata.TestMetadata.test_summary_presence)
SKIP: test target mailing list: Series merged, no reason to check other mailing lists (test_mbox.TestMbox.test_target_mailing_list)

---

Please address the issues identified and
submit a new revision of the patch, or alternatively, reply to this email with an explanation of why the patch should be accepted. If you believe these results are due to an error in patchtest, please submit a bug at https://bugzilla.yoctoproject.org/ (use the 'Patchtest' category under 'Yocto Project Subprojects'). For more information on specific failures, see: https://wiki.yoctoproject.org/wiki/Patchtest. Thank you!

#2 lore raw
In reply to [email protected]

Thanks, the patch is ok, but you need to actually open a dnf pull request with the patch, and not just the ticket (also 'Submitted' means that the patch was actually provided to upstream). It's okay if upstream then rejects the patch. We'll at least try to convince them :)

Alex

Quoted 92 lines · Changqing Li

From: Changqing Li <[email protected]>

dnf has a bug, refer [1], it causes that log_lock.pid may not removed after dnf exit. And for native dnf, since we change the lock file path to /, it will never be removed, and make the rootfs not clean,refer [2][3]. This patch is a workaround to fix above issue.

[1] https://github.com/rpm-software-management/dnf/issues/1963
[2] https://git.openembedded.org/openembedded-core/commit/?id=742a1b71249f4da1c8d8e13e270b0eb6128a3f66
[3] https://github.com/rpm-software-management/dnf/blob/master/etc/tmpfiles.d/dnf.conf

---
 ...n.py-remove-log_lock.pid-before-exit.patch | 41 +++++++++++++++++++
 meta/recipes-devtools/dnf/dnf_4.18.2.bb       |  3 +-
 2 files changed, 43 insertions(+), 1 deletion(-)
 create mode 100644 meta/recipes-devtools/dnf/dnf/0001-main.py-remove-log_lock.pid-before-exit.patch
meta/recipes-devtools/dnf/dnf/0001-main.py-remove-log_lock.pid-before-exit.patch new file +41 -0
new file mode 100644
index 0000000000..ae036cbbd6
@@ -0,0 +1,41 @@
+From bdf17281385cf33ad59267fe75a9e427e6e2ffc4 Mon Sep 17 00:00:00 2001
+From: Changqing Li <[email protected]>
+Date: Thu, 7 Mar 2024 14:03:07 +0800
+Subject: [PATCH] main.py: remove log_lock.pid before exit
+
+dnf has a bug, refer [1], it causes that log_lock.pid may not removed
+after dnf exit. And for native dnf, since we change the lock file path
+to /, it will never be removed, and make the rootfs not clean,refer
+[2][3].  This patch is a workaround to fix above issue.
+
+[1] https://github.com/rpm-software-management/dnf/issues/1963
+[2] https://git.openembedded.org/openembedded-core/commit/?id=742a1b71249f4da1c8d8e13e270b0eb6128a3f66
+[3] https://github.com/rpm-software-management/dnf/blob/master/etc/tmpfiles.d/dnf.conf
+
+Upstream-Status: Submited [ report to https://github.com/rpm-software-management/dnf/issues/1963]
+
+Signed-off-by: Changqing Li <[email protected]>
+---
+ dnf/cli/main.py | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+diff --git a/dnf/cli/main.py b/dnf/cli/main.py
+index 2a7f92d54..2f672cff2 100644
+--- a/dnf/cli/main.py
++++ b/dnf/cli/main.py
+@@ -200,6 +200,12 @@ def user_main(args, exit_code=False):
+
+     errcode = main(args)
+     if exit_code:
++        for arg in args:
++            if arg.startswith("--installroot="):
++                root=arg.split("=")[1]
++                if os.path.exists(os.path.join(root, "log_lock.pid")):
++                    os.unlink(os.path.join(root, "log_lock.pid"))
++                break
+         sys.exit(errcode)
+     return errcode
+
+--
+2.25.1
+
meta/recipes-devtools/dnf/dnf_4.18.2.bb +2 -2
index dc0c18be5e..7770c9d7e0 100644
@@ -17,7 +17,8 @@ SRC_URI = "git://github.com/rpm-software-management/dnf.git;branch=master;protoc
            file://0001-set-python-path-for-completion_helper.patch \
            "
 
-SRC_URI:append:class-native = "file://0001-dnf-write-the-log-lock-to-root.patch"
+SRC_URI:append:class-native = "file://0001-dnf-write-the-log-lock-to-root.patch \
+                               file://0001-main.py-remove-log_lock.pid-before-exit.patch"
 
 SRCREV = "1c43d0999178d492381ad0b43917ffd9c74016f8"
 UPSTREAM_CHECK_GITTAGREGEX = "(?P<pver>\d+(\.\d+)+)"
--

2.25.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#196770): https://lists.openembedded.org/g/openembedded-core/message/196770
Mute This Topic: https://lists.openembedded.org/mt/104782944/1686489
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#3 lore raw
Quoted 10 lines · Alexander Kanavin

CAUTION: This email comes from a non Wind River email account!
Do not click links or open attachments unless you recognize the sender and know the content is safe.

Thanks, the patch is ok, but you need to actually open a dnf pull request with the patch, and not just the ticket (also 'Submitted' means that the patch was actually provided to upstream). It's okay if upstream then rejects the patch. We'll at least try to convince them :)

Alex

ok, I will send an pull request and send a v2 with the pull request.

Thanks

Changqing

Quoted 97 lines
Quoted 94 lines · Changqing Li

From: Changqing Li <[email protected]>

dnf has a bug, refer [1], it causes that log_lock.pid may not removed after dnf exit. And for native dnf, since we change the lock file path to /, it will never be removed, and make the rootfs not clean,refer [2][3]. This patch is a workaround to fix above issue.

[1] https://github.com/rpm-software-management/dnf/issues/1963
[2] https://git.openembedded.org/openembedded-core/commit/?id=742a1b71249f4da1c8d8e13e270b0eb6128a3f66
[3] https://github.com/rpm-software-management/dnf/blob/master/etc/tmpfiles.d/dnf.conf

---
  ...n.py-remove-log_lock.pid-before-exit.patch | 41 +++++++++++++++++++
  meta/recipes-devtools/dnf/dnf_4.18.2.bb       |  3 +-
  2 files changed, 43 insertions(+), 1 deletion(-)

create mode 100644 meta/recipes-devtools/dnf/dnf/0001-main.py-remove-log_lock.pid-before-exit.patch

meta/recipes-devtools/dnf/dnf/0001-main.py-remove-log_lock.pid-before-exit.patch new file +41 -0
new file mode 100644
index 0000000000..ae036cbbd6
@@ -0,0 +1,41 @@
+From bdf17281385cf33ad59267fe75a9e427e6e2ffc4 Mon Sep 17 00:00:00 2001
+From: Changqing Li <[email protected]>
+Date: Thu, 7 Mar 2024 14:03:07 +0800
+Subject: [PATCH] main.py: remove log_lock.pid before exit
+
+dnf has a bug, refer [1], it causes that log_lock.pid may not removed
+after dnf exit. And for native dnf, since we change the lock file path
+to /, it will never be removed, and make the rootfs not clean,refer
+[2][3].  This patch is a workaround to fix above issue.
+
+[1] https://github.com/rpm-software-management/dnf/issues/1963
+[2] https://git.openembedded.org/openembedded-core/commit/?id=742a1b71249f4da1c8d8e13e270b0eb6128a3f66
+[3] https://github.com/rpm-software-management/dnf/blob/master/etc/tmpfiles.d/dnf.conf
+
+Upstream-Status: Submited [ report to https://github.com/rpm-software-management/dnf/issues/1963]
+
+Signed-off-by: Changqing Li <[email protected]>
+---
+ dnf/cli/main.py | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+diff --git a/dnf/cli/main.py b/dnf/cli/main.py
+index 2a7f92d54..2f672cff2 100644
+--- a/dnf/cli/main.py
++++ b/dnf/cli/main.py
+@@ -200,6 +200,12 @@ def user_main(args, exit_code=False):
+
+     errcode = main(args)
+     if exit_code:
++        for arg in args:
++            if arg.startswith("--installroot="):
++                root=arg.split("=")[1]
++                if os.path.exists(os.path.join(root, "log_lock.pid")):
++                    os.unlink(os.path.join(root, "log_lock.pid"))
++                break
+         sys.exit(errcode)
+     return errcode
+
+--
+2.25.1
+
meta/recipes-devtools/dnf/dnf_4.18.2.bb +2 -2
index dc0c18be5e..7770c9d7e0 100644
@@ -17,7 +17,8 @@ SRC_URI = "git://github.com/rpm-software-management/dnf.git;branch=master;protoc
             file://0001-set-python-path-for-completion_helper.patch \
             "
 
-SRC_URI:append:class-native = "file://0001-dnf-write-the-log-lock-to-root.patch"
+SRC_URI:append:class-native = "file://0001-dnf-write-the-log-lock-to-root.patch \
+                               file://0001-main.py-remove-log_lock.pid-before-exit.patch"
 
  SRCREV = "1c43d0999178d492381ad0b43917ffd9c74016f8"
  UPSTREAM_CHECK_GITTAGREGEX = "(?P<pver>\d+(\.\d+)+)"
--

2.25.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#196776): https://lists.openembedded.org/g/openembedded-core/message/196776
Mute This Topic: https://lists.openembedded.org/mt/104782944/3616873
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-