[Buildroot] [git commit branch/2025.05.x] package/policycoreutils: fix build with musl due to getpass()
Thomas Perale
thomas.perale at mind.be
Thu Sep 18 09:39:48 UTC 2025
commit: https://git.buildroot.net/buildroot/commit/?id=47a77649a7f28573e0d1f3b7aac909a8f7b3df85
branch: https://git.buildroot.net/buildroot/commit/?id=refs/heads/2025.05.x
policycoreutils uses getpass(), which with musl is only defined with
some feature macro defined, such as _GNU_SOURCE. So let's pick-up an
upstream fix to address this issue.
There are no autobuilder failures, the issue was most likely hidden by
other failures with musl affecting the SELinux stack.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni at bootlin.com>
Signed-off-by: Julien Olivain <ju.o at free.fr>
(cherry picked from commit fc472cc8c75406ae10d2cbb3d0a8e10889f692a6)
[thomas: fix patch]
Signed-off-by: Thomas Perale <thomas.perale at mind.be>
---
...licycoreutils-run_init-define-_GNU_SOURCE.patch | 39 ++++++++++++++++++++++
1 file changed, 39 insertions(+)
diff --git a/package/policycoreutils/0003-policycoreutils-run_init-define-_GNU_SOURCE.patch b/package/policycoreutils/0003-policycoreutils-run_init-define-_GNU_SOURCE.patch
new file mode 100644
index 0000000000..ca26506b74
--- /dev/null
+++ b/package/policycoreutils/0003-policycoreutils-run_init-define-_GNU_SOURCE.patch
@@ -0,0 +1,39 @@
+From f338b2e7d2bbf70cb811eb1331162e33deb4ce6c Mon Sep 17 00:00:00 2001
+From: Robert Marko <robimarko at gmail.com>
+Date: Thu, 1 May 2025 21:59:13 +0200
+Subject: [PATCH] policycoreutils: run_init: define _GNU_SOURCE
+
+Trying to compile run_init with musl will fail with:
+run_init.c: In function 'authenticate_via_shadow_passwd':
+run_init.c:206:40: error: implicit declaration of function 'getpass' [-Wimplicit-function-declaration]
+ 206 | if (!(unencrypted_password_s = getpass(PASSWORD_PROMPT))) {
+
+This is because getpass in musl is guarded only for _GNU_SOURCE, so
+define _GNU_SOURCE for run_init.
+
+Signed-off-by: Robert Marko <robimarko at gmail.com>
+Acked-by: James Carter <jwcart2 at gmail.com>
+Upstream: 50bafc3d9c08cf26c3b0f61e29157a0ea8efbf4a
+Signed-off-by: Thomas Petazzoni <thomas.petazzoni at bootlin.com>
+[thomas: fix filename]
+Signed-off-by: Thomas Perale <thomas.perale at mind.be>
+---
+ run_init/run_init.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/run_init/run_init.c b/run_init/run_init.c
+index ce499781..4531a8ba 100644
+--- a/run_init/run_init.c
++++ b/run_init/run_init.c
+@@ -37,6 +37,8 @@
+ *
+ *************************************************************************/
+
++#define _GNU_SOURCE
++
+ #include <stdio.h>
+ #include <stdlib.h> /* for malloc(), realloc(), free() */
+ #include <pwd.h> /* for getpwuid() */
+--
+2.51.0
+
More information about the buildroot
mailing list