* [Buildroot] [PATCH 1/1] package/ledmon: update patch to fix musl build
@ 2025-12-01 18:31 Bernd Kuhls
2025-12-30 17:44 ` Thomas Petazzoni via buildroot
2026-01-13 19:45 ` Arnout Vandecappelle via buildroot
0 siblings, 2 replies; 3+ messages in thread
From: Bernd Kuhls @ 2025-12-01 18:31 UTC (permalink / raw)
To: buildroot; +Cc: Maksim Kiselev
Updated patch following an upstream review:
https://github.com/md-raid-utilities/ledmon/pull/272#issuecomment-3596495739
Signed-off-by: Bernd Kuhls <bernd@kuhls.net>
---
Build-tested using this defconfig
BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_EUDEV=y
BR2_PACKAGE_LEDMON=y
35 builds, 6 skipped, 0 build failed, 0 legal-info failed, 0 show-info failed
...-Include-libgen.h-to-fix-musl-builds.patch | 100 ------------------
...e-basename-if-GLIBC-is-not-avialable.patch | 42 ++++++++
2 files changed, 42 insertions(+), 100 deletions(-)
delete mode 100644 package/ledmon/0001-Include-libgen.h-to-fix-musl-builds.patch
create mode 100644 package/ledmon/0001-libled-provide-basename-if-GLIBC-is-not-avialable.patch
diff --git a/package/ledmon/0001-Include-libgen.h-to-fix-musl-builds.patch b/package/ledmon/0001-Include-libgen.h-to-fix-musl-builds.patch
deleted file mode 100644
index 713aaee020..0000000000
--- a/package/ledmon/0001-Include-libgen.h-to-fix-musl-builds.patch
+++ /dev/null
@@ -1,100 +0,0 @@
-From 95adecd3cc8e94f9964c34fdf0354c209acce166 Mon Sep 17 00:00:00 2001
-From: Bernd Kuhls <bernd@kuhls.net>
-Date: Thu, 27 Nov 2025 21:17:22 +0100
-Subject: [PATCH] Include libgen.h to fix musl builds
-
-Fixes various build errors like
-
-block.c: In function 'block_set_devnode':
-block.c:226:22: error: implicit declaration of function 'basename'
- [-Wimplicit-function-declaration]
- 226 | char *name = basename(device->sysfs_path);
-
-Upstream: https://github.com/md-raid-utilities/ledmon/pull/272
-
-Signed-off-by: Bernd Kuhls <bernd@kuhls.net>
-[Bernd: backported upstream PR to v1.1.0]
----
- src/ledctl/ledctl.c | 1 +
- src/ledmon/ledmon.c | 1 +
- src/lib/block.c | 1 +
- src/lib/npem.c | 1 +
- src/lib/slot.c | 1 +
- src/lib/vmdssd.c | 1 +
- 6 files changed, 6 insertions(+)
-
-diff --git a/src/ledctl/ledctl.c b/src/ledctl/ledctl.c
-index 30adc74..af2ea1b 100644
---- a/src/ledctl/ledctl.c
-+++ b/src/ledctl/ledctl.c
-@@ -5,6 +5,7 @@
- #include <ctype.h>
- #include <errno.h>
- #include <getopt.h>
-+#include <libgen.h>
- #include <linux/limits.h>
- #include <inttypes.h>
- #include <limits.h>
-diff --git a/src/ledmon/ledmon.c b/src/ledmon/ledmon.c
-index 37ef69a..4644492 100644
---- a/src/ledmon/ledmon.c
-+++ b/src/ledmon/ledmon.c
-@@ -5,6 +5,7 @@
- #include <errno.h>
- #include <fcntl.h>
- #include <getopt.h>
-+#include <libgen.h>
- #include <limits.h>
- #include <signal.h>
- #include <stdint.h>
-diff --git a/src/lib/block.c b/src/lib/block.c
-index 23dc34f..afa7d57 100644
---- a/src/lib/block.c
-+++ b/src/lib/block.c
-@@ -3,6 +3,7 @@
-
- #include <dirent.h>
- #include <fcntl.h>
-+#include <libgen.h>
- #include <limits.h>
- #include <stdint.h>
- #include <stdio.h>
-diff --git a/src/lib/npem.c b/src/lib/npem.c
-index bdceee3..f980ba8 100644
---- a/src/lib/npem.c
-+++ b/src/lib/npem.c
-@@ -2,6 +2,7 @@
- // Copyright (C) 2022 Intel Corporation.
-
- #include <errno.h>
-+#include <libgen.h>
- #include <stdio.h>
- #include <string.h>
- #include <pci/pci.h>
-diff --git a/src/lib/slot.c b/src/lib/slot.c
-index 1044ddf..68e3009 100644
---- a/src/lib/slot.c
-+++ b/src/lib/slot.c
-@@ -1,6 +1,7 @@
- // SPDX-License-Identifier: LGPL-2.1-or-later
- // Copyright (C) 2023 Intel Corporation.
-
-+#include <libgen.h>
- #include <stdio.h>
- #include <string.h>
-
-diff --git a/src/lib/vmdssd.c b/src/lib/vmdssd.c
-index 8a6e846..0270a7d 100644
---- a/src/lib/vmdssd.c
-+++ b/src/lib/vmdssd.c
-@@ -2,6 +2,7 @@
- // Copyright (C) 2022 Intel Corporation.
-
- #include <errno.h>
-+#include <libgen.h>
- #include <limits.h>
- #include <stdlib.h>
- #include <stdint.h>
---
-2.47.3
-
diff --git a/package/ledmon/0001-libled-provide-basename-if-GLIBC-is-not-avialable.patch b/package/ledmon/0001-libled-provide-basename-if-GLIBC-is-not-avialable.patch
new file mode 100644
index 0000000000..a205f41b6f
--- /dev/null
+++ b/package/ledmon/0001-libled-provide-basename-if-GLIBC-is-not-avialable.patch
@@ -0,0 +1,42 @@
+From 4c0477bdaef56314eb4df4a432be54cc49238be0 Mon Sep 17 00:00:00 2001
+From: Bernd Kuhls <bernd@kuhls.net>
+Date: Mon, 1 Dec 2025 19:07:42 +0100
+Subject: [PATCH] libled: provide basename if GLIBC is not avialable
+
+If GNU basename is not avilable, define it. It is safer to use that
+rather than include libgen.h with XPG basename() definition.
+
+Suggested in
+https://github.com/md-raid-utilities/ledmon/pull/272#issuecomment-3596495739
+
+Code copied from
+https://github.com/md-raid-utilities/mdadm/commit/9dbd11e091f84eb0bf9d717283774816c4c4453d
+
+Upstream: https://github.com/md-raid-utilities/ledmon/pull/272
+
+Signed-off-by: Bernd Kuhls <bernd@kuhls.net>
+---
+ src/lib/libled_internal.h | 9 +++++++++
+ 1 file changed, 9 insertions(+)
+
+diff --git a/src/lib/libled_internal.h b/src/lib/libled_internal.h
+index 2355d30..2061fc2 100644
+--- a/src/lib/libled_internal.h
++++ b/src/lib/libled_internal.h
+@@ -70,4 +70,13 @@ led_status_t device_exclude_pattern_add(struct led_ctx *ctx, const char *path);
+ */
+ void lib_log(struct led_ctx *ctx, enum led_log_level_enum loglevel, const char *buf, ...)
+ __attribute__ ((format (printf, 3, 4)));
++
++/*
++ * Ensure GNU basename behavior on GLIBC less systems.
++ */
++#ifndef __GLIBC__
++#define basename(path) \
++ (strrchr((path), '/') ? strrchr((path),'/') + 1 : (path))
++#endif
++
+ #endif
+--
+2.47.3
+
--
2.47.3
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Buildroot] [PATCH 1/1] package/ledmon: update patch to fix musl build
2025-12-01 18:31 [Buildroot] [PATCH 1/1] package/ledmon: update patch to fix musl build Bernd Kuhls
@ 2025-12-30 17:44 ` Thomas Petazzoni via buildroot
2026-01-13 19:45 ` Arnout Vandecappelle via buildroot
1 sibling, 0 replies; 3+ messages in thread
From: Thomas Petazzoni via buildroot @ 2025-12-30 17:44 UTC (permalink / raw)
To: Bernd Kuhls; +Cc: buildroot, Maksim Kiselev
On Mon, 1 Dec 2025 19:31:42 +0100
Bernd Kuhls <bernd@kuhls.net> wrote:
> Updated patch following an upstream review:
> https://github.com/md-raid-utilities/ledmon/pull/272#issuecomment-3596495739
>
> Signed-off-by: Bernd Kuhls <bernd@kuhls.net>
> ---
> Build-tested using this defconfig
Applied to master, thanks.
Thomas
--
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Buildroot] [PATCH 1/1] package/ledmon: update patch to fix musl build
2025-12-01 18:31 [Buildroot] [PATCH 1/1] package/ledmon: update patch to fix musl build Bernd Kuhls
2025-12-30 17:44 ` Thomas Petazzoni via buildroot
@ 2026-01-13 19:45 ` Arnout Vandecappelle via buildroot
1 sibling, 0 replies; 3+ messages in thread
From: Arnout Vandecappelle via buildroot @ 2026-01-13 19:45 UTC (permalink / raw)
To: Bernd Kuhls; +Cc: Arnout Vandecappelle, buildroot
In reply of:
> Updated patch following an upstream review:
> https://github.com/md-raid-utilities/ledmon/pull/272#issuecomment-3596495739
>
> Signed-off-by: Bernd Kuhls <bernd@kuhls.net>
Applied to 2025.02.x and 2025.11.x. Thanks
> ---
> Build-tested using this defconfig
>
> BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_EUDEV=y
> BR2_PACKAGE_LEDMON=y
>
> 35 builds, 6 skipped, 0 build failed, 0 legal-info failed, 0 show-info failed
>
> ...-Include-libgen.h-to-fix-musl-builds.patch | 100 ------------------
> ...e-basename-if-GLIBC-is-not-avialable.patch | 42 ++++++++
> 2 files changed, 42 insertions(+), 100 deletions(-)
> delete mode 100644 package/ledmon/0001-Include-libgen.h-to-fix-musl-builds.patch
> create mode 100644 package/ledmon/0001-libled-provide-basename-if-GLIBC-is-not-avialable.patch
>
> diff --git a/package/ledmon/0001-Include-libgen.h-to-fix-musl-builds.patch b/package/ledmon/0001-Include-libgen.h-to-fix-musl-builds.patch
> deleted file mode 100644
> index 713aaee020..0000000000
> --- a/package/ledmon/0001-Include-libgen.h-to-fix-musl-builds.patch
> +++ /dev/null
> @@ -1,100 +0,0 @@
> -From 95adecd3cc8e94f9964c34fdf0354c209acce166 Mon Sep 17 00:00:00 2001
> -From: Bernd Kuhls <bernd@kuhls.net>
> -Date: Thu, 27 Nov 2025 21:17:22 +0100
> -Subject: [PATCH] Include libgen.h to fix musl builds
> -
> -Fixes various build errors like
> -
> -block.c: In function 'block_set_devnode':
> -block.c:226:22: error: implicit declaration of function 'basename'
> - [-Wimplicit-function-declaration]
> - 226 | char *name = basename(device->sysfs_path);
> -
> -Upstream: https://github.com/md-raid-utilities/ledmon/pull/272
> -
> -Signed-off-by: Bernd Kuhls <bernd@kuhls.net>
> -[Bernd: backported upstream PR to v1.1.0]
> ----
> - src/ledctl/ledctl.c | 1 +
> - src/ledmon/ledmon.c | 1 +
> - src/lib/block.c | 1 +
> - src/lib/npem.c | 1 +
> - src/lib/slot.c | 1 +
> - src/lib/vmdssd.c | 1 +
> - 6 files changed, 6 insertions(+)
> -
> -diff --git a/src/ledctl/ledctl.c b/src/ledctl/ledctl.c
> -index 30adc74..af2ea1b 100644
> ---- a/src/ledctl/ledctl.c
> -+++ b/src/ledctl/ledctl.c
> -@@ -5,6 +5,7 @@
> - #include <ctype.h>
> - #include <errno.h>
> - #include <getopt.h>
> -+#include <libgen.h>
> - #include <linux/limits.h>
> - #include <inttypes.h>
> - #include <limits.h>
> -diff --git a/src/ledmon/ledmon.c b/src/ledmon/ledmon.c
> -index 37ef69a..4644492 100644
> ---- a/src/ledmon/ledmon.c
> -+++ b/src/ledmon/ledmon.c
> -@@ -5,6 +5,7 @@
> - #include <errno.h>
> - #include <fcntl.h>
> - #include <getopt.h>
> -+#include <libgen.h>
> - #include <limits.h>
> - #include <signal.h>
> - #include <stdint.h>
> -diff --git a/src/lib/block.c b/src/lib/block.c
> -index 23dc34f..afa7d57 100644
> ---- a/src/lib/block.c
> -+++ b/src/lib/block.c
> -@@ -3,6 +3,7 @@
> -
> - #include <dirent.h>
> - #include <fcntl.h>
> -+#include <libgen.h>
> - #include <limits.h>
> - #include <stdint.h>
> - #include <stdio.h>
> -diff --git a/src/lib/npem.c b/src/lib/npem.c
> -index bdceee3..f980ba8 100644
> ---- a/src/lib/npem.c
> -+++ b/src/lib/npem.c
> -@@ -2,6 +2,7 @@
> - // Copyright (C) 2022 Intel Corporation.
> -
> - #include <errno.h>
> -+#include <libgen.h>
> - #include <stdio.h>
> - #include <string.h>
> - #include <pci/pci.h>
> -diff --git a/src/lib/slot.c b/src/lib/slot.c
> -index 1044ddf..68e3009 100644
> ---- a/src/lib/slot.c
> -+++ b/src/lib/slot.c
> -@@ -1,6 +1,7 @@
> - // SPDX-License-Identifier: LGPL-2.1-or-later
> - // Copyright (C) 2023 Intel Corporation.
> -
> -+#include <libgen.h>
> - #include <stdio.h>
> - #include <string.h>
> -
> -diff --git a/src/lib/vmdssd.c b/src/lib/vmdssd.c
> -index 8a6e846..0270a7d 100644
> ---- a/src/lib/vmdssd.c
> -+++ b/src/lib/vmdssd.c
> -@@ -2,6 +2,7 @@
> - // Copyright (C) 2022 Intel Corporation.
> -
> - #include <errno.h>
> -+#include <libgen.h>
> - #include <limits.h>
> - #include <stdlib.h>
> - #include <stdint.h>
> ---
> -2.47.3
> -
> diff --git a/package/ledmon/0001-libled-provide-basename-if-GLIBC-is-not-avialable.patch b/package/ledmon/0001-libled-provide-basename-if-GLIBC-is-not-avialable.patch
> new file mode 100644
> index 0000000000..a205f41b6f
> --- /dev/null
> +++ b/package/ledmon/0001-libled-provide-basename-if-GLIBC-is-not-avialable.patch
> @@ -0,0 +1,42 @@
> +From 4c0477bdaef56314eb4df4a432be54cc49238be0 Mon Sep 17 00:00:00 2001
> +From: Bernd Kuhls <bernd@kuhls.net>
> +Date: Mon, 1 Dec 2025 19:07:42 +0100
> +Subject: [PATCH] libled: provide basename if GLIBC is not avialable
> +
> +If GNU basename is not avilable, define it. It is safer to use that
> +rather than include libgen.h with XPG basename() definition.
> +
> +Suggested in
> +https://github.com/md-raid-utilities/ledmon/pull/272#issuecomment-3596495739
> +
> +Code copied from
> +https://github.com/md-raid-utilities/mdadm/commit/9dbd11e091f84eb0bf9d717283774816c4c4453d
> +
> +Upstream: https://github.com/md-raid-utilities/ledmon/pull/272
> +
> +Signed-off-by: Bernd Kuhls <bernd@kuhls.net>
> +---
> + src/lib/libled_internal.h | 9 +++++++++
> + 1 file changed, 9 insertions(+)
> +
> +diff --git a/src/lib/libled_internal.h b/src/lib/libled_internal.h
> +index 2355d30..2061fc2 100644
> +--- a/src/lib/libled_internal.h
> ++++ b/src/lib/libled_internal.h
> +@@ -70,4 +70,13 @@ led_status_t device_exclude_pattern_add(struct led_ctx *ctx, const char *path);
> + */
> + void lib_log(struct led_ctx *ctx, enum led_log_level_enum loglevel, const char *buf, ...)
> + __attribute__ ((format (printf, 3, 4)));
> ++
> ++/*
> ++ * Ensure GNU basename behavior on GLIBC less systems.
> ++ */
> ++#ifndef __GLIBC__
> ++#define basename(path) \
> ++ (strrchr((path), '/') ? strrchr((path),'/') + 1 : (path))
> ++#endif
> ++
> + #endif
> +--
> +2.47.3
> +
> --
> 2.47.3
>
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-01-13 19:46 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-01 18:31 [Buildroot] [PATCH 1/1] package/ledmon: update patch to fix musl build Bernd Kuhls
2025-12-30 17:44 ` Thomas Petazzoni via buildroot
2026-01-13 19:45 ` Arnout Vandecappelle via buildroot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox