diff options
author | Khem Raj <raj.khem@gmail.com> | 2023-12-10 12:25:47 -0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2023-12-13 11:34:27 +0000 |
commit | 86a377ebe788d7fa202b4b041d575ed4a0e0589e (patch) | |
tree | ff1b332a499b5249425044698eea4d10ab9b07e6 /meta/recipes-core | |
parent | 52ec79a6d305c6053acb3b9a761d1645ee5d502f (diff) | |
download | poky-86a377ebe788d7fa202b4b041d575ed4a0e0589e.tar.gz |
util-linux: Fix build with latest musl
Musl has removed basename declaration in string.h which exposes this
error.
(From OE-Core rev: c9ac0d6136bfb126c022d13fcafb94f8ee16052e)
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-core')
-rw-r--r-- | meta/recipes-core/util-linux/util-linux.inc | 1 | ||||
-rw-r--r-- | meta/recipes-core/util-linux/util-linux/0001-login-utils-include-libgen.h-for-basename-API.patch | 57 |
2 files changed, 58 insertions, 0 deletions
diff --git a/meta/recipes-core/util-linux/util-linux.inc b/meta/recipes-core/util-linux/util-linux.inc index 952a680a84..e3bef5acfc 100644 --- a/meta/recipes-core/util-linux/util-linux.inc +++ b/meta/recipes-core/util-linux/util-linux.inc | |||
@@ -36,6 +36,7 @@ SRC_URI = "${KERNELORG_MIRROR}/linux/utils/util-linux/v${MAJOR_VERSION}/util-lin | |||
36 | file://display_testname_for_subtest.patch \ | 36 | file://display_testname_for_subtest.patch \ |
37 | file://avoid_parallel_tests.patch \ | 37 | file://avoid_parallel_tests.patch \ |
38 | file://0001-lscpu-Use-4K-buffer-size-instead-of-BUFSIZ.patch \ | 38 | file://0001-lscpu-Use-4K-buffer-size-instead-of-BUFSIZ.patch \ |
39 | file://0001-login-utils-include-libgen.h-for-basename-API.patch \ | ||
39 | " | 40 | " |
40 | 41 | ||
41 | SRC_URI[sha256sum] = "87abdfaa8e490f8be6dde976f7c80b9b5ff9f301e1b67e3899e1f05a59a1531f" | 42 | SRC_URI[sha256sum] = "87abdfaa8e490f8be6dde976f7c80b9b5ff9f301e1b67e3899e1f05a59a1531f" |
diff --git a/meta/recipes-core/util-linux/util-linux/0001-login-utils-include-libgen.h-for-basename-API.patch b/meta/recipes-core/util-linux/util-linux/0001-login-utils-include-libgen.h-for-basename-API.patch new file mode 100644 index 0000000000..2b9897ade1 --- /dev/null +++ b/meta/recipes-core/util-linux/util-linux/0001-login-utils-include-libgen.h-for-basename-API.patch | |||
@@ -0,0 +1,57 @@ | |||
1 | From 6581cf8ac95b99b5a35fea88c52646558d05b5e7 Mon Sep 17 00:00:00 2001 | ||
2 | From: Khem Raj <raj.khem@gmail.com> | ||
3 | Date: Sun, 3 Dec 2023 19:59:46 -0800 | ||
4 | Subject: [PATCH] login-utils: include libgen.h for basename API | ||
5 | |||
6 | musl has removed the non-prototype declaration of basename from string.h [1] which now results in build errors with clang-17+ compiler | ||
7 | |||
8 | include libgen.h for using the posix declaration of the funciton. | ||
9 | |||
10 | Fixes | ||
11 | |||
12 | ../util-linux-2.39.2/login-utils/su-common.c:847:20: error: call to undeclared function 'basename'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration] | ||
13 | 847 | shell_basename = basename(shell); | ||
14 | | ^ | ||
15 | |||
16 | [1] https://git.musl-libc.org/cgit/musl/commit/?id=725e17ed6dff4d0cd22487bb64470881e86a92e7 | ||
17 | |||
18 | Upstream-Status: Submitted [https://github.com/util-linux/util-linux/pull/2615] | ||
19 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
20 | --- | ||
21 | login-utils/su-common.c | 8 ++++++-- | ||
22 | 1 file changed, 6 insertions(+), 2 deletions(-) | ||
23 | |||
24 | --- a/login-utils/su-common.c | ||
25 | +++ b/login-utils/su-common.c | ||
26 | @@ -26,6 +26,7 @@ | ||
27 | #include <sys/types.h> | ||
28 | #include <pwd.h> | ||
29 | #include <grp.h> | ||
30 | +#include <libgen.h> | ||
31 | #include <security/pam_appl.h> | ||
32 | #ifdef HAVE_SECURITY_PAM_MISC_H | ||
33 | # include <security/pam_misc.h> | ||
34 | @@ -840,17 +841,20 @@ static void run_shell( | ||
35 | su->simulate_login ? " login" : "", | ||
36 | su->fast_startup ? " fast-start" : "")); | ||
37 | |||
38 | + char* tmp = xstrdup(shell); | ||
39 | if (su->simulate_login) { | ||
40 | char *arg0; | ||
41 | char *shell_basename; | ||
42 | |||
43 | - shell_basename = basename(shell); | ||
44 | + shell_basename = basename(tmp); | ||
45 | arg0 = xmalloc(strlen(shell_basename) + 2); | ||
46 | arg0[0] = '-'; | ||
47 | strcpy(arg0 + 1, shell_basename); | ||
48 | args[0] = arg0; | ||
49 | - } else | ||
50 | - args[0] = basename(shell); | ||
51 | + } else { | ||
52 | + args[0] = basename(tmp); | ||
53 | + } | ||
54 | + free(tmp); | ||
55 | |||
56 | if (su->fast_startup) | ||
57 | args[argno++] = "-f"; | ||