Skip to contentSkip to conversation

overlayfs-tools: Fix build with musl

PATCH New Khem Raj 1 participant 1 message Jul 6, 2024

lore
Share & tools
lore

Khem Raj

author
#0 lore raw

PATCH 1/1 overlayfs-tools: Fix build with musl

---
 .../0001-always-use-glibc-basename.patch      | 38 +++++++++++++
 ...program_name-to-have-const-attribute.patch | 56 +++++++++++++++++++
 .../overlayfs/overlayfs-tools_v2024.07.bb     |  2 +
 3 files changed, 96 insertions(+)
 create mode 100644 meta-filesystems/recipes-utils/overlayfs/overlayfs-tools/0001-always-use-glibc-basename.patch
 create mode 100644 meta-filesystems/recipes-utils/overlayfs/overlayfs-tools/0002-Change-program_name-to-have-const-attribute.patch
meta-filesystems/recipes-utils/overlayfs/overlayfs-tools/0001-always-use-glibc-basename.patch new file +38 -0
new file mode 100644
index 0000000000..78802e39ab
@@ -0,0 +1,38 @@
+From 2fa94fc7adf05fae46204f4665216c8b019010f3 Mon Sep 17 00:00:00 2001
+From: Khem Raj <[email protected]>
+Date: Fri, 5 Jul 2024 23:16:38 -0700
+Subject: [PATCH 1/2] 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/kmxz/overlayfs-tools/pull/26]
+Signed-off-by: Khem Raj <[email protected]>
+---
+ main.c | 12 ++++++++++++
+ 1 file changed, 12 insertions(+)
+
+diff --git a/main.c b/main.c
+index 7b669eb..ea0f5a5 100644
+--- a/main.c
++++ b/main.c
+@@ -30,6 +30,18 @@ bool brief;
+ bool ignore;
+ extern char *program_name;
+ 
++#ifndef __GLIBC__
++/*
++ * GNU basename implementation
++ */
++static const char *__basename(const char *filename) {
++    char *p = strrchr(filename, '/');
++    return p ? p + 1 : filename;
++}
++
++#define basename(x) __basename(x)
++#endif
++
+ void print_help(const char *program) {
+     printf("Usage: %s command options\n", program);
+     puts("");
meta-filesystems/recipes-utils/overlayfs/overlayfs-tools/0002-Change-program_name-to-have-const-attribute.patch new file +56 -0

56 lines not on this page · raw message

meta-filesystems/recipes-utils/overlayfs/overlayfs-tools_v2024.07.bb +2 -0
index 0ca6477f45..d11ee0c479 100644
@@ -5,6 +5,8 @@ LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=f312a7c4d02230e8f2b537295d375c69"
 
 SRC_URI = "\
     git://github.com/kmxz/overlayfs-tools.git;protocol=https;branch=master \
+    file://0001-always-use-glibc-basename.patch \
+    file://0002-Change-program_name-to-have-const-attribute.patch \
 "
 
 SRCREV = "7a4a0c4f2c6c86aa46a40e3468e394fd4a237491"