[Buildroot] [PATCH 03/11] package/policycoreutils: fix build with musl due to getpass()

Thomas Perale thomas.perale at mind.be
Fri Sep 19 12:56:21 UTC 2025


In reply of:
> 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>

Applied to 2025.02.x, 2025.05.x & 2025.08.x. Thanks

> ---
>  ...oreutils-run_init-define-_GNU_SOURCE.patch | 37 +++++++++++++++++++
>  1 file changed, 37 insertions(+)
>  create mode 100644 package/policycoreutils/0003-policycoreutils-run_init-define-_GNU_SOURCE.patch
> 
> 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..bef6909b0a
> --- /dev/null
> +++ b/package/policycoreutils/0003-policycoreutils-run_init-define-_GNU_SOURCE.patch
> @@ -0,0 +1,37 @@
> +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>
> +---
> + policycoreutils/run_init/run_init.c | 2 ++
> + 1 file changed, 2 insertions(+)
> +
> +diff --git a/policycoreutils/run_init/run_init.c b/policycoreutils/run_init/run_init.c
> +index ce499781..4531a8ba 100644
> +--- a/policycoreutils/run_init/run_init.c
> ++++ b/policycoreutils/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
> +
> -- 
> 2.51.0
> 
> _______________________________________________
> buildroot mailing list
> buildroot at buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot


More information about the buildroot mailing list