diff mbox series

dnf: remove log_lock.pid before exit

Message ID 20240307064856.879596-1-changqing.li@windriver.com
State New
Headers show
Series dnf: remove log_lock.pid before exit | expand

Commit Message

Changqing Li March 7, 2024, 6:48 a.m. UTC
From: Changqing Li <changqing.li@windriver.com>

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

Signed-off-by: Changqing Li <changqing.li@windriver.com>
---
 ...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

Comments

patchtest@automation.yoctoproject.org March 7, 2024, 7:09 a.m. UTC | #1
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!
Alexander Kanavin March 7, 2024, 8:13 a.m. UTC | #2
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

On Thu, 7 Mar 2024 at 07:49, Changqing Li
<changqing.li@eng.windriver.com> wrote:
>
> From: Changqing Li <changqing.li@windriver.com>
>
> 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
>
> Signed-off-by: Changqing Li <changqing.li@windriver.com>
> ---
>  ...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
>
> diff --git a/meta/recipes-devtools/dnf/dnf/0001-main.py-remove-log_lock.pid-before-exit.patch b/meta/recipes-devtools/dnf/dnf/0001-main.py-remove-log_lock.pid-before-exit.patch
> new file mode 100644
> index 0000000000..ae036cbbd6
> --- /dev/null
> +++ b/meta/recipes-devtools/dnf/dnf/0001-main.py-remove-log_lock.pid-before-exit.patch
> @@ -0,0 +1,41 @@
> +From bdf17281385cf33ad59267fe75a9e427e6e2ffc4 Mon Sep 17 00:00:00 2001
> +From: Changqing Li <changqing.li@windriver.com>
> +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 <changqing.li@windriver.com>
> +---
> + 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
> +
> diff --git a/meta/recipes-devtools/dnf/dnf_4.18.2.bb b/meta/recipes-devtools/dnf/dnf_4.18.2.bb
> index dc0c18be5e..7770c9d7e0 100644
> --- a/meta/recipes-devtools/dnf/dnf_4.18.2.bb
> +++ b/meta/recipes-devtools/dnf/dnf_4.18.2.bb
> @@ -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: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [alex.kanavin@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
Changqing Li March 7, 2024, 8:52 a.m. UTC | #3
On 3/7/24 16:14, Alexander Kanavin wrote:
> 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

>
> On Thu, 7 Mar 2024 at 07:49, Changqing Li
> <changqing.li@eng.windriver.com> wrote:
>> From: Changqing Li <changqing.li@windriver.com>
>>
>> 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
>>
>> Signed-off-by: Changqing Li <changqing.li@windriver.com>
>> ---
>>   ...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
>>
>> diff --git a/meta/recipes-devtools/dnf/dnf/0001-main.py-remove-log_lock.pid-before-exit.patch b/meta/recipes-devtools/dnf/dnf/0001-main.py-remove-log_lock.pid-before-exit.patch
>> new file mode 100644
>> index 0000000000..ae036cbbd6
>> --- /dev/null
>> +++ b/meta/recipes-devtools/dnf/dnf/0001-main.py-remove-log_lock.pid-before-exit.patch
>> @@ -0,0 +1,41 @@
>> +From bdf17281385cf33ad59267fe75a9e427e6e2ffc4 Mon Sep 17 00:00:00 2001
>> +From: Changqing Li <changqing.li@windriver.com>
>> +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 <changqing.li@windriver.com>
>> +---
>> + 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
>> +
>> diff --git a/meta/recipes-devtools/dnf/dnf_4.18.2.bb b/meta/recipes-devtools/dnf/dnf_4.18.2.bb
>> index dc0c18be5e..7770c9d7e0 100644
>> --- a/meta/recipes-devtools/dnf/dnf_4.18.2.bb
>> +++ b/meta/recipes-devtools/dnf/dnf_4.18.2.bb
>> @@ -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: openembedded-core+owner@lists.openembedded.org
>> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [changqing.li@eng.windriver.com]
>> -=-=-=-=-=-=-=-=-=-=-=-
>>
diff mbox series

Patch

diff --git a/meta/recipes-devtools/dnf/dnf/0001-main.py-remove-log_lock.pid-before-exit.patch b/meta/recipes-devtools/dnf/dnf/0001-main.py-remove-log_lock.pid-before-exit.patch
new file mode 100644
index 0000000000..ae036cbbd6
--- /dev/null
+++ b/meta/recipes-devtools/dnf/dnf/0001-main.py-remove-log_lock.pid-before-exit.patch
@@ -0,0 +1,41 @@ 
+From bdf17281385cf33ad59267fe75a9e427e6e2ffc4 Mon Sep 17 00:00:00 2001
+From: Changqing Li <changqing.li@windriver.com>
+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 <changqing.li@windriver.com>
+---
+ 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
+
diff --git a/meta/recipes-devtools/dnf/dnf_4.18.2.bb b/meta/recipes-devtools/dnf/dnf_4.18.2.bb
index dc0c18be5e..7770c9d7e0 100644
--- a/meta/recipes-devtools/dnf/dnf_4.18.2.bb
+++ b/meta/recipes-devtools/dnf/dnf_4.18.2.bb
@@ -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+)+)"