connman: Fix build with musl
PATCH 1/2 connman: Fix build with musl
--- ....c-Include-libgen.h-for-basename-API.patch | 55 +++++++++++++++++++ .../connman/connman_1.42.bb | 1 + 2 files changed, 56 insertions(+) create mode 100644 meta/recipes-connectivity/connman/connman/0001-src-log.c-Include-libgen.h-for-basename-API.patch
meta/recipes-connectivity/connman/connman/0001-src-log.c-Include-libgen.h-for-basename-API.patch new file +55 -0
@@ -0,0 +1,55 @@ +From cbba6638986c2de763981bf6fc59df6a86fed44f Mon Sep 17 00:00:00 2001 +From: Khem Raj <[email protected]> +Date: Mon, 1 Jan 2024 17:42:21 -0800 +Subject: [PATCH v2] src/log.c: Include libgen.h for basename API + +Use POSIX version of basename. This comes to front with latest musl +which dropped the declaration from string.h [1] it fails to build with +clang-17+ because it treats implicit function declaration as error. + +Fix it by applying the basename on a copy of string since posix version +may modify the input string. + +[1] https://git.musl-libc.org/cgit/musl/commit/?id=725e17ed6dff4d0cd22487bb64470881e86a92e7 + +Upstream-Status: Submitted [https://lore.kernel.org/connman/[email protected]/T/#u] +Signed-off-by: Khem Raj <[email protected]> +--- + + src/log.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/src/log.c b/src/log.c +index 554b046..2df3af7 100644 +--- a/src/log.c ++++ b/src/log.c +@@ -24,6 +24,7 @@ + #endif + + #include <stdio.h> ++#include <libgen.h> + #include <unistd.h> + #include <stdarg.h> + #include <stdlib.h> +@@ -196,6 +197,7 @@ int __connman_log_init(const char *program, const char *debug, + const char *program_name, const char *program_version) + { + static char path[PATH_MAX]; ++ char* tmp = strdup(program); + int option = LOG_NDELAY | LOG_PID; + + program_exec = program; +@@ -212,8 +214,8 @@ int __connman_log_init(const char *program, const char *debug, + if (backtrace) + signal_setup(signal_handler); + +- openlog(basename(program), option, LOG_DAEMON); +- ++ openlog(basename(tmp), option, LOG_DAEMON); ++ free(tmp); + syslog(LOG_INFO, "%s version %s", program_name, program_version); + + return 0; +-- +2.43.0 +
meta/recipes-connectivity/connman/connman_1.42.bb +1 -0
@@ -6,6 +6,7 @@ SRC_URI = "${KERNELORG_MIRROR}/linux/network/${BPN}/${BP}.tar.xz \ file://connman \ file://no-version-scripts.patch \ file://0001-vpn-Adding-support-for-latest-pppd-2.5.0-release.patch \ + file://0001-src-log.c-Include-libgen.h-for-basename-API.patch \ " SRC_URI:append:libc-musl = " file://0002-resolve-musl-does-not-implement-res_ninit.patch"
Signature · 1 line
2.43.0
PATCH 2/2 rpm: Fix build with musl
--- ...lename-before-passing-it-to-basename.patch | 40 +++++++++++++++++++ ...ix-missing-basename-include-on-macOS.patch | 26 ++++++++++++ meta/recipes-devtools/rpm/rpm_4.18.1.bb | 2 + 3 files changed, 68 insertions(+) create mode 100644 meta/recipes-devtools/rpm/files/0001-Duplicate-filename-before-passing-it-to-basename.patch create mode 100644 meta/recipes-devtools/rpm/files/0001-Fix-missing-basename-include-on-macOS.patch
meta/recipes-devtools/rpm/files/0001-Duplicate-filename-before-passing-it-to-basename.patch new file +40 -0
@@ -0,0 +1,40 @@ +From 3fa2ae78db9b31edb4c22f3b5cd36c6c972947f1 Mon Sep 17 00:00:00 2001 +From: Florian Festi <[email protected]> +Date: Wed, 26 Jul 2023 15:01:35 +0200 +Subject: [PATCH] Duplicate filename before passing it to basename + +basename is allowed change the string passed to it. While we don't need +the filename after that just casting away the const seems a bit too +hacky. + +Upstream-Status: Backport [https://github.com/rpm-software-management/rpm/commit/3fa2ae78db9b31edb4c22f3b5cd36c6c972947f1] +Signed-off-by: Khem Raj <[email protected]> +--- + tools/rpmuncompress.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/tools/rpmuncompress.c b/tools/rpmuncompress.c +index 58ddf5683..e13cc6a66 100644 +--- a/tools/rpmuncompress.c ++++ b/tools/rpmuncompress.c +@@ -98,7 +98,8 @@ static char *doUntar(const char *fn) + if (needtar) { + rasprintf(&buf, "%s '%s' | %s %s -", zipper, fn, tar, taropts); + } else if (at->compressed == COMPRESSED_GEM) { +- const char *bn = basename(fn); ++ char *tmp = xstrdup(fn); ++ const char *bn = basename(tmp); + size_t nvlen = strlen(bn) - 3; + char *gem = rpmGetPath("%{__gem}", NULL); + char *gemspec = NULL; +@@ -112,6 +113,7 @@ static char *doUntar(const char *fn) + + free(gemspec); + free(gem); ++ free(tmp); + } else { + rasprintf(&buf, "%s '%s'", zipper, fn); + } +-- +2.43.0 +
meta/recipes-devtools/rpm/files/0001-Fix-missing-basename-include-on-macOS.patch new file +26 -0
@@ -0,0 +1,26 @@ +From b2e67642fd8cb64d8cb1cca9e759396c1c10807d Mon Sep 17 00:00:00 2001 +From: Calvin Buckley <[email protected]> +Date: Tue, 11 Jul 2023 19:22:41 -0300 +Subject: [PATCH] Fix missing basename include on macOS + +Upstream-Status: Backport [https://github.com/rpm-software-management/rpm/commit/b2e67642fd8cb64d8cb1cca9e759396c1c10807d] +Signed-off-by: Khem Raj <[email protected]> +--- + tools/rpmuncompress.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/tools/rpmuncompress.c b/tools/rpmuncompress.c +index bd4146d54..58ddf5683 100644 +--- a/tools/rpmuncompress.c ++++ b/tools/rpmuncompress.c +@@ -1,6 +1,7 @@ + #include "system.h" + + #include <popt.h> ++#include <libgen.h> + #include <errno.h> + #include <stdio.h> + #include <string.h> +-- +2.43.0 +
meta/recipes-devtools/rpm/rpm_4.18.1.bb +2 -0
@@ -40,6 +40,8 @@ SRC_URI = "git://github.com/rpm-software-management/rpm;branch=rpm-4.18.x;protoc file://0001-python-Use-Py_hash_t-instead-of-long-in-hdr_hash.patch \ file://fix-declaration.patch \ file://ea3187cfcf9cac87e5bc5e7db79b0338da9e355e.patch \ + file://0001-Duplicate-filename-before-passing-it-to-basename.patch \ + file://0001-Fix-missing-basename-include-on-macOS.patch \ " PE = "1"
Signature · 1 line
2.43.0
Patchtest results for [PATCH 2/2] rpm: Fix build with musl
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/2-2-rpm-Fix-build-with-musl.patch
FAIL: test commit message presence: Please include a commit message on your patch explaining the change (test_mbox.TestMbox.test_commit_message_presence)
PASS: pretest src uri left files (test_metadata.TestMetadata.pretest_src_uri_left_files)
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 Upstream-Status presence (test_patch.TestPatch.test_upstream_status_presence_format)
PASS: test author valid (test_mbox.TestMbox.test_author_valid)
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!
Patchtest results for [PATCH 1/2] connman: Fix build with musl
In reply to Khem RajThank 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/1-2-connman-Fix-build-with-musl.patch
FAIL: test commit message presence: Please include a commit message on your patch explaining the change (test_mbox.TestMbox.test_commit_message_presence)
PASS: pretest src uri left files (test_metadata.TestMetadata.pretest_src_uri_left_files)
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 Upstream-Status presence (test_patch.TestPatch.test_upstream_status_presence_format)
PASS: test author valid (test_mbox.TestMbox.test_author_valid)
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!