diff mbox series

[meta-oe] multipath-tools: Fix build with musl >= 1.2.5

Message ID 20240327020452.1437678-1-raj.khem@gmail.com
State New
Headers show
Series [meta-oe] multipath-tools: Fix build with musl >= 1.2.5 | expand

Commit Message

Khem Raj March 27, 2024, 2:04 a.m. UTC
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 ...bmultipath-always-use-glibc-basename.patch | 42 +++++++++++++++++++
 .../multipath-tools/multipath-tools_0.9.8.bb  |  1 +
 2 files changed, 43 insertions(+)
 create mode 100644 meta-oe/recipes-support/multipath-tools/files/0001-libmultipath-always-use-glibc-basename.patch
diff mbox series

Patch

diff --git a/meta-oe/recipes-support/multipath-tools/files/0001-libmultipath-always-use-glibc-basename.patch b/meta-oe/recipes-support/multipath-tools/files/0001-libmultipath-always-use-glibc-basename.patch
new file mode 100644
index 0000000000..0365a7ef64
--- /dev/null
+++ b/meta-oe/recipes-support/multipath-tools/files/0001-libmultipath-always-use-glibc-basename.patch
@@ -0,0 +1,42 @@ 
+From 389286b25a903be62ce7f964246824fcc20c4c67 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Tue, 26 Mar 2024 18:56:55 -0700
+Subject: [PATCH] libmultipath: always use glibc basename()
+
+There is a use of basename() which expects it to be GNU version of
+basename, which is not available in other libcs e.g. musl on Linux
+therefore provide a version for such cases
+
+Upstream-Status: Submitted [https://github.com/opensvc/multipath-tools/pull/84]
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ libmultipath/configure.c | 13 +++++++++++++
+ 1 file changed, 13 insertions(+)
+
+diff --git a/libmultipath/configure.c b/libmultipath/configure.c
+index 4ecf6ba4..e81cc67c 100644
+--- a/libmultipath/configure.c
++++ b/libmultipath/configure.c
+@@ -43,6 +43,19 @@
+ #include "sysfs.h"
+ #include "io_err_stat.h"
+ 
++#ifndef __GLIBC__
++/*
++ * glibc's non-destructive version of basename()
++ * License: LGPL-2.1-or-later
++ */
++static const char *__basename(const char *filename)
++{
++	char *p = strrchr(filename, '/');
++	return p ? p + 1 : filename;
++}
++#define basename(x) __basename(x)
++#endif
++
+ /* group paths in pg by host adapter
+  */
+ int group_by_host_adapter(struct pathgroup *pgp, vector adapters)
+-- 
+2.44.0
+
diff --git a/meta-oe/recipes-support/multipath-tools/multipath-tools_0.9.8.bb b/meta-oe/recipes-support/multipath-tools/multipath-tools_0.9.8.bb
index df95df6f70..e9f01bd1fe 100644
--- a/meta-oe/recipes-support/multipath-tools/multipath-tools_0.9.8.bb
+++ b/meta-oe/recipes-support/multipath-tools/multipath-tools_0.9.8.bb
@@ -44,6 +44,7 @@  SRC_URI = "git://github.com/opensvc/multipath-tools.git;protocol=https;branch=ma
            file://0010-Subject-PATCH-Always-use-devmapper.patch \
            file://0011-fix-bug-of-do_compile-and-do_install.patch \
            file://0012-add-explicit-dependency-on-libraries.patch \
+           file://0001-libmultipath-always-use-glibc-basename.patch \
            "
 
 LIC_FILES_CHKSUM = "file://COPYING;md5=5f30f0716dfdd0d91eb439ebec522ec2"