diff options
author | Khem Raj <raj.khem@gmail.com> | 2024-07-05 23:25:35 -0700 |
---|---|---|
committer | Khem Raj <raj.khem@gmail.com> | 2024-07-05 23:26:51 -0700 |
commit | 6f3784d1b7c24c56e5df26cc17216c75eb6e4e52 (patch) | |
tree | 3979f95c13123109f17c40551e2c012f99ed1dc4 /meta-filesystems | |
parent | 1c3abfdbd85e086344e5e5893a6022b546e55c11 (diff) | |
download | meta-openembedded-6f3784d1b7c24c56e5df26cc17216c75eb6e4e52.tar.gz |
overlayfs-tools: Fix build with musl
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Diffstat (limited to 'meta-filesystems')
3 files changed, 96 insertions, 0 deletions
diff --git a/meta-filesystems/recipes-utils/overlayfs/overlayfs-tools/0001-always-use-glibc-basename.patch b/meta-filesystems/recipes-utils/overlayfs/overlayfs-tools/0001-always-use-glibc-basename.patch new file mode 100644 index 000000000..78802e39a --- /dev/null +++ b/meta-filesystems/recipes-utils/overlayfs/overlayfs-tools/0001-always-use-glibc-basename.patch | |||
@@ -0,0 +1,38 @@ | |||
1 | From 2fa94fc7adf05fae46204f4665216c8b019010f3 Mon Sep 17 00:00:00 2001 | ||
2 | From: Khem Raj <raj.khem@gmail.com> | ||
3 | Date: Fri, 5 Jul 2024 23:16:38 -0700 | ||
4 | Subject: [PATCH 1/2] always use glibc basename() | ||
5 | |||
6 | There is a use of basename() which expects it to be GNU version of | ||
7 | basename, which is not available in other libcs e.g. musl on Linux | ||
8 | therefore provide a version for such cases | ||
9 | |||
10 | Upstream-Status: Submitted [https://github.com/kmxz/overlayfs-tools/pull/26] | ||
11 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
12 | --- | ||
13 | main.c | 12 ++++++++++++ | ||
14 | 1 file changed, 12 insertions(+) | ||
15 | |||
16 | diff --git a/main.c b/main.c | ||
17 | index 7b669eb..ea0f5a5 100644 | ||
18 | --- a/main.c | ||
19 | +++ b/main.c | ||
20 | @@ -30,6 +30,18 @@ bool brief; | ||
21 | bool ignore; | ||
22 | extern char *program_name; | ||
23 | |||
24 | +#ifndef __GLIBC__ | ||
25 | +/* | ||
26 | + * GNU basename implementation | ||
27 | + */ | ||
28 | +static const char *__basename(const char *filename) { | ||
29 | + char *p = strrchr(filename, '/'); | ||
30 | + return p ? p + 1 : filename; | ||
31 | +} | ||
32 | + | ||
33 | +#define basename(x) __basename(x) | ||
34 | +#endif | ||
35 | + | ||
36 | void print_help(const char *program) { | ||
37 | printf("Usage: %s command options\n", program); | ||
38 | puts(""); | ||
diff --git a/meta-filesystems/recipes-utils/overlayfs/overlayfs-tools/0002-Change-program_name-to-have-const-attribute.patch b/meta-filesystems/recipes-utils/overlayfs/overlayfs-tools/0002-Change-program_name-to-have-const-attribute.patch new file mode 100644 index 000000000..845306292 --- /dev/null +++ b/meta-filesystems/recipes-utils/overlayfs/overlayfs-tools/0002-Change-program_name-to-have-const-attribute.patch | |||
@@ -0,0 +1,56 @@ | |||
1 | From be694ba90aa2e0fed3a4e9b53ad7a61efd0430c5 Mon Sep 17 00:00:00 2001 | ||
2 | From: Khem Raj <raj.khem@gmail.com> | ||
3 | Date: Fri, 5 Jul 2024 23:18:07 -0700 | ||
4 | Subject: [PATCH 2/2] Change program_name to have const attribute | ||
5 | |||
6 | This is how it is used in all places and it also avoids a const to | ||
7 | non-const conversion warning | ||
8 | |||
9 | Upstream-Status: Submitted [https://github.com/kmxz/overlayfs-tools/pull/26] | ||
10 | |||
11 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
12 | --- | ||
13 | common.c | 2 +- | ||
14 | fsck.c | 2 +- | ||
15 | main.c | 2 +- | ||
16 | 3 files changed, 3 insertions(+), 3 deletions(-) | ||
17 | |||
18 | diff --git a/common.c b/common.c | ||
19 | index eaf24a8..a15b66f 100644 | ||
20 | --- a/common.c | ||
21 | +++ b/common.c | ||
22 | @@ -29,7 +29,7 @@ | ||
23 | #include "common.h" | ||
24 | #include "config.h" | ||
25 | |||
26 | -char *program_name; | ||
27 | +const char *program_name; | ||
28 | |||
29 | /* #define DEBUG 1 */ | ||
30 | #ifdef DEBUG | ||
31 | diff --git a/fsck.c b/fsck.c | ||
32 | index 4e513f5..285b9f1 100644 | ||
33 | --- a/fsck.c | ||
34 | +++ b/fsck.c | ||
35 | @@ -46,7 +46,7 @@ | ||
36 | #include "mount.h" | ||
37 | #include "overlayfs.h" | ||
38 | |||
39 | -extern char *program_name; | ||
40 | +extern const char *program_name; | ||
41 | |||
42 | struct ovl_fs ofs = {}; | ||
43 | int flags = 0; /* user input option flags */ | ||
44 | diff --git a/main.c b/main.c | ||
45 | index ea0f5a5..1a8b239 100644 | ||
46 | --- a/main.c | ||
47 | +++ b/main.c | ||
48 | @@ -28,7 +28,7 @@ | ||
49 | bool verbose; | ||
50 | bool brief; | ||
51 | bool ignore; | ||
52 | -extern char *program_name; | ||
53 | +extern const char *program_name; | ||
54 | |||
55 | #ifndef __GLIBC__ | ||
56 | /* | ||
diff --git a/meta-filesystems/recipes-utils/overlayfs/overlayfs-tools_v2024.07.bb b/meta-filesystems/recipes-utils/overlayfs/overlayfs-tools_v2024.07.bb index 0ca6477f4..d11ee0c47 100644 --- a/meta-filesystems/recipes-utils/overlayfs/overlayfs-tools_v2024.07.bb +++ b/meta-filesystems/recipes-utils/overlayfs/overlayfs-tools_v2024.07.bb | |||
@@ -5,6 +5,8 @@ LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=f312a7c4d02230e8f2b537295d375c69" | |||
5 | 5 | ||
6 | SRC_URI = "\ | 6 | SRC_URI = "\ |
7 | git://github.com/kmxz/overlayfs-tools.git;protocol=https;branch=master \ | 7 | git://github.com/kmxz/overlayfs-tools.git;protocol=https;branch=master \ |
8 | file://0001-always-use-glibc-basename.patch \ | ||
9 | file://0002-Change-program_name-to-have-const-attribute.patch \ | ||
8 | " | 10 | " |
9 | 11 | ||
10 | SRCREV = "7a4a0c4f2c6c86aa46a40e3468e394fd4a237491" | 12 | SRCREV = "7a4a0c4f2c6c86aa46a40e3468e394fd4a237491" |