diff mbox series

[v4] bluez5: Fix build with musl

Message ID 20240828041000.2409672-1-raj.khem@gmail.com
State Accepted, archived
Commit e5f9870757bf7ffd009ce4ba999d37e41274982c
Headers show
Series [v4] bluez5: Fix build with musl | expand

Commit Message

Khem Raj Aug. 28, 2024, 4:10 a.m. UTC
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
v2: Fix the upstream submission and latest patch submitted upstream
v3: Make just node_name as const and keep node_dir as such
v4: Redo the patch to avoid textrel errors on ppc32/arm

 meta/recipes-connectivity/bluez5/bluez5.inc   |   1 +
 ...U-basename-compatible-implementation.patch | 143 ++++++++++++++++++
 2 files changed, 144 insertions(+)
 create mode 100644 meta/recipes-connectivity/bluez5/bluez5/0001-Provide-GNU-basename-compatible-implementation.patch

Comments

patchtest@automation.yoctoproject.org Aug. 28, 2024, 4:18 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/v4-bluez5-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: 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 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)

SKIP: pretest pylint: No python related patches, skipping test (test_python_pylint.PyLint.pretest_pylint)
SKIP: pretest src uri left files: No modified recipes, skipping pretest (test_metadata.TestMetadata.pretest_src_uri_left_files)
SKIP: test CVE check ignore: No modified recipes or older target branch, skipping test (test_metadata.TestMetadata.test_cve_check_ignore)
SKIP: test bugzilla entry format: No bug ID found (test_mbox.TestMbox.test_bugzilla_entry_format)
SKIP: test lic files chksum modified not mentioned: No modified recipes, skipping test (test_metadata.TestMetadata.test_lic_files_chksum_modified_not_mentioned)
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 src uri left files: No modified recipes, skipping pretest (test_metadata.TestMetadata.test_src_uri_left_files)
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!
diff mbox series

Patch

diff --git a/meta/recipes-connectivity/bluez5/bluez5.inc b/meta/recipes-connectivity/bluez5/bluez5.inc
index d8b9f817715..e0d3e651871 100644
--- a/meta/recipes-connectivity/bluez5/bluez5.inc
+++ b/meta/recipes-connectivity/bluez5/bluez5.inc
@@ -70,6 +70,7 @@  SRC_URI = "${KERNELORG_MIRROR}/linux/bluetooth/bluez-${PV}.tar.xz \
            file://0001-tests-add-a-target-for-building-tests-without-runnin.patch \
            file://0001-test-gatt-Fix-hung-issue.patch \
            file://0004-src-shared-util.c-include-linux-limits.h.patch \
+           file://0001-Provide-GNU-basename-compatible-implementation.patch \
            "
 S = "${WORKDIR}/bluez-${PV}"
 
diff --git a/meta/recipes-connectivity/bluez5/bluez5/0001-Provide-GNU-basename-compatible-implementation.patch b/meta/recipes-connectivity/bluez5/bluez5/0001-Provide-GNU-basename-compatible-implementation.patch
new file mode 100644
index 00000000000..3a2a97ff020
--- /dev/null
+++ b/meta/recipes-connectivity/bluez5/bluez5/0001-Provide-GNU-basename-compatible-implementation.patch
@@ -0,0 +1,143 @@ 
+From 9000923c07a68857e8ea32a49bfca660b1d1001a Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Mon, 26 Aug 2024 09:55:03 -0700
+Subject: [PATCH BlueZ] Provide GNU basename compatible implementation
+
+Call to basename() relies on a GNU extension
+to take a const char * vs a char *. Let's define
+a trivial helper function to ensure compatibility
+with musl.
+
+Fixes Issue: https://github.com/bluez/bluez/issues/843
+
+Upstream-Status: Submitted [https://lore.kernel.org/linux-bluetooth/20240826173844.2918630-1-raj.khem@gmail.com/T/#u]
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ Makefile.mesh           | 2 ++
+ Makefile.tools          | 3 ++-
+ mesh/mesh-config-json.c | 6 ++++--
+ mesh/rpl.c              | 3 ++-
+ src/shared/util.h       | 7 +++++++
+ tools/hex2hcd.c         | 3 ++-
+ 6 files changed, 19 insertions(+), 5 deletions(-)
+
+Index: bluez-5.77/mesh/mesh-config-json.c
+===================================================================
+--- bluez-5.77.orig/mesh/mesh-config-json.c
++++ bluez-5.77/mesh/mesh-config-json.c
+@@ -28,6 +28,7 @@
+ #include <ell/ell.h>
+ #include <json-c/json.h>
+ 
++#include "mesh/missing.h"
+ #include "mesh/mesh-defs.h"
+ #include "mesh/util.h"
+ #include "mesh/mesh-config.h"
+@@ -2694,7 +2695,8 @@ bool mesh_config_load_nodes(const char *
+ 
+ void mesh_config_destroy_nvm(struct mesh_config *cfg)
+ {
+-	char *node_dir, *node_name;
++	char *node_dir;
++	const char* node_name;
+ 	char uuid[33];
+ 
+ 	if (!cfg)
+Index: bluez-5.77/mesh/rpl.c
+===================================================================
+--- bluez-5.77.orig/mesh/rpl.c
++++ bluez-5.77/mesh/rpl.c
+@@ -24,6 +24,7 @@
+ 
+ #include <ell/ell.h>
+ 
++#include "mesh/missing.h"
+ #include "mesh/mesh-defs.h"
+ 
+ #include "mesh/node.h"
+Index: bluez-5.77/tools/hex2hcd.c
+===================================================================
+--- bluez-5.77.orig/tools/hex2hcd.c
++++ bluez-5.77/tools/hex2hcd.c
+@@ -24,6 +24,7 @@
+ #include <stdlib.h>
+ #include <stdbool.h>
+ #include <sys/stat.h>
++#include "tools/missing.h"
+ 
+ static ssize_t process_record(int fd, const char *line, uint16_t *upper_addr)
+ {
+Index: bluez-5.77/configure.ac
+===================================================================
+--- bluez-5.77.orig/configure.ac
++++ bluez-5.77/configure.ac
+@@ -70,7 +70,16 @@ AC_CHECK_LIB(pthread, pthread_create, du
+ AC_CHECK_LIB(dl, dlopen, dummy=yes,
+ 			AC_MSG_ERROR(dynamic linking loader is required))
+ 
+-AC_CHECK_HEADERS(linux/types.h linux/if_alg.h linux/uinput.h linux/uhid.h sys/random.h)
++AC_CHECK_HEADERS(string.h linux/types.h linux/if_alg.h linux/uinput.h linux/uhid.h sys/random.h)
++
++# basename may be only available in libgen.h with the POSIX behavior,
++# not desired here
++AC_CHECK_DECLS([basename], [],
++				AC_MSG_WARN([GNU basename extension not found]),
++				[#define _GNU_SOURCE 1
++				 #include <string.h>
++				 ])
++
+ 
+ PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.28)
+ 
+Index: bluez-5.77/tools/missing.h
+===================================================================
+--- /dev/null
++++ bluez-5.77/tools/missing.h
+@@ -0,0 +1,21 @@
++// SPDX-License-Identifier: LGPL-2.1-or-later
++/*
++ *
++ *  BlueZ - Bluetooth protocol stack for Linux
++ *
++ *  Copyright (C) 2024  Khem Raj <raj.khem@gmail.com>
++ *
++ */
++
++#ifdef HAVE_CONFIG_H
++#include <config.h>
++#endif
++#if !HAVE_DECL_BASENAME
++#include <string.h>
++static inline const char *basename(const char *path)
++{
++  const char *base = strrchr(path, '/');
++
++  return base ? base + 1 : path;
++}
++#endif
+Index: bluez-5.77/mesh/missing.h
+===================================================================
+--- /dev/null
++++ bluez-5.77/mesh/missing.h
+@@ -0,0 +1,21 @@
++// SPDX-License-Identifier: LGPL-2.1-or-later
++/*
++ *
++ *  BlueZ - Bluetooth protocol stack for Linux
++ *
++ *  Copyright (C) 2024  Khem Raj <raj.khem@gmail.com>
++ *
++ */
++
++#ifdef HAVE_CONFIG_H
++#include <config.h>
++#endif
++#if !HAVE_DECL_BASENAME
++#include <string.h>
++static inline const char *basename(const char *path)
++{
++  const char *base = strrchr(path, '/');
++
++  return base ? base + 1 : path;
++}
++#endif