diff options
Diffstat (limited to 'meta-filesystems/recipes-support/composefs/files/0001-musl-basename-use-portable-implementation-for-basena.patch')
-rw-r--r-- | meta-filesystems/recipes-support/composefs/files/0001-musl-basename-use-portable-implementation-for-basena.patch | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/meta-filesystems/recipes-support/composefs/files/0001-musl-basename-use-portable-implementation-for-basena.patch b/meta-filesystems/recipes-support/composefs/files/0001-musl-basename-use-portable-implementation-for-basena.patch new file mode 100644 index 000000000..49a0b21c6 --- /dev/null +++ b/meta-filesystems/recipes-support/composefs/files/0001-musl-basename-use-portable-implementation-for-basena.patch | |||
@@ -0,0 +1,75 @@ | |||
1 | From b21a9d4f10a066cac76bb345d31fdd24afcf3e6f Mon Sep 17 00:00:00 2001 | ||
2 | From: Fathi Boudra <fathi.boudra@linaro.org> | ||
3 | Date: Tue, 9 Apr 2024 08:47:37 +0200 | ||
4 | Subject: [PATCH] musl: basename: use portable implementation for basename API | ||
5 | |||
6 | musl has removed the non-prototype declaration of basename from string.h which | ||
7 | now results in build errors with newer clang compilers. | ||
8 | |||
9 | Implement GNU basename behavior using strchr which is portable across libcs. | ||
10 | |||
11 | Fixes: | ||
12 | | ../../git/tools/mountcomposefs.c:43:20: | ||
13 | | error: call to undeclared function 'basename'; ISO C99 and later do not | ||
14 | | support implicit function declarations [-Wimplicit-function-declaration] | ||
15 | | 43 | const char *bin = basename(argv0); | ||
16 | | | ^ | ||
17 | | ../../git/tools/mountcomposefs.c:43:14: | ||
18 | | error: incompatible integer to pointer conversion initializing 'const char *' | ||
19 | | with an expression of type 'int' [-Wint-conversion] | ||
20 | | 43 | const char *bin = basename(argv0); | ||
21 | | | ^ ~~~~~~~~~~~~~~~ | ||
22 | |||
23 | For reference: | ||
24 | https://git.musl-libc.org/cgit/musl/commit/?id=725e17ed6dff4d0cd22487bb64470881e86a92e7 | ||
25 | |||
26 | Closes: https://github.com/containers/composefs/issues/272 | ||
27 | |||
28 | Signed-off-by: Fathi Boudra <fathi.boudra@linaro.org> | ||
29 | |||
30 | Upstream-Status: Submitted [https://github.com/containers/composefs/pull/273] | ||
31 | --- | ||
32 | libcomposefs/lcfs-utils.h | 6 ++++++ | ||
33 | tools/mkcomposefs.c | 2 +- | ||
34 | tools/mountcomposefs.c | 3 ++- | ||
35 | 3 files changed, 9 insertions(+), 2 deletions(-) | ||
36 | |||
37 | --- a/tools/mountcomposefs.c | ||
38 | +++ b/tools/mountcomposefs.c | ||
39 | @@ -37,10 +37,11 @@ | ||
40 | #include <linux/fsverity.h> | ||
41 | |||
42 | #include "libcomposefs/lcfs-mount.h" | ||
43 | +#include "libcomposefs/lcfs-utils.h" | ||
44 | |||
45 | static void usage(const char *argv0) | ||
46 | { | ||
47 | - const char *bin = basename(argv0); | ||
48 | + const char *bin = gnu_basename(argv0); | ||
49 | fprintf(stderr, | ||
50 | "usage: %s [-t type] [-o opt[,opts..]] IMAGE MOUNTPOINT\n" | ||
51 | "Example:\n" | ||
52 | --- a/libcomposefs/lcfs-utils.h | ||
53 | +++ b/libcomposefs/lcfs-utils.h | ||
54 | @@ -161,4 +161,10 @@ static inline void *steal_pointer(void * | ||
55 | /* type safety */ | ||
56 | #define steal_pointer(pp) (0 ? (*(pp)) : (steal_pointer)(pp)) | ||
57 | |||
58 | +static inline const char *gnu_basename(const char *filename) | ||
59 | +{ | ||
60 | + const char *p = strrchr(filename, '/'); | ||
61 | + return p ? p+1 : filename; | ||
62 | +} | ||
63 | + | ||
64 | #endif | ||
65 | --- a/tools/mkcomposefs.c | ||
66 | +++ b/tools/mkcomposefs.c | ||
67 | @@ -315,7 +315,7 @@ static int fill_store(struct lcfs_node_s | ||
68 | |||
69 | static void usage(const char *argv0) | ||
70 | { | ||
71 | - const char *bin = basename(argv0); | ||
72 | + const char *bin = gnu_basename(argv0); | ||
73 | fprintf(stderr, | ||
74 | "Usage: %s [OPTIONS] SOURCE IMAGE\n" | ||
75 | "Options:\n" | ||