diff options
author | Khem Raj <raj.khem@gmail.com> | 2022-09-03 10:18:20 -0700 |
---|---|---|
committer | Khem Raj <raj.khem@gmail.com> | 2022-09-05 22:49:35 -0700 |
commit | 014326ebcaf757086ce3f4e594fd32653199cd9d (patch) | |
tree | f119072000c4dccaed74104aeb889e6e1268ac74 | |
parent | b0d2977fb1ee47061269e1570b527794fbca290c (diff) | |
download | meta-openembedded-014326ebcaf757086ce3f4e594fd32653199cd9d.tar.gz |
autofs: Backport innetgr and strerror_r musl patches
Fixes build with musl/x86
Signed-off-by: Khem Raj <raj.khem@gmail.com>
3 files changed, 162 insertions, 0 deletions
diff --git a/meta-networking/recipes-daemons/autofs/autofs/0001-autofs-5.1.8-add-autofs_strerror_r-helper-for-musl.patch b/meta-networking/recipes-daemons/autofs/autofs/0001-autofs-5.1.8-add-autofs_strerror_r-helper-for-musl.patch new file mode 100644 index 000000000..5fd9a8d12 --- /dev/null +++ b/meta-networking/recipes-daemons/autofs/autofs/0001-autofs-5.1.8-add-autofs_strerror_r-helper-for-musl.patch | |||
@@ -0,0 +1,54 @@ | |||
1 | From 88f991b0ebb6fb8fcaad3d0eb8fb51a7439d053e Mon Sep 17 00:00:00 2001 | ||
2 | From: Fabian Groffen <grobian@gentoo.org> | ||
3 | Date: Wed, 2 Feb 2022 09:27:13 +0800 | ||
4 | Subject: [PATCH 1/2] autofs-5.1.8 - add autofs_strerror_r() helper for musl | ||
5 | |||
6 | If using musl libc the XSI-compliant variant strerror_r() which returns | ||
7 | an integer instead of a pointer so add a helper function to handle this | ||
8 | case. | ||
9 | |||
10 | Signed-off-by: Fabian Groffen <grobian@gentoo.org> | ||
11 | Signed-off-by: Ian Kent <raven@themaw.net> | ||
12 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
13 | --- | ||
14 | include/automount.h | 5 +++++ | ||
15 | lib/log.c | 10 ++++++++++ | ||
16 | 2 files changed, 15 insertions(+) | ||
17 | |||
18 | diff --git a/include/automount.h b/include/automount.h | ||
19 | index 8cd8b3a..f759e59 100644 | ||
20 | --- a/include/automount.h | ||
21 | +++ b/include/automount.h | ||
22 | @@ -51,6 +51,11 @@ | ||
23 | # endif | ||
24 | #endif | ||
25 | |||
26 | +#ifndef __GLIBC__ | ||
27 | +# define strerror_r(N,B,S) autofs_strerror_r(N,B,S) | ||
28 | +char *autofs_strerror_r(int errnum, char *buf, size_t buflen); /* GNU */ | ||
29 | +#endif | ||
30 | + | ||
31 | /* We MUST have the paths to mount(8) and umount(8) */ | ||
32 | #ifndef HAVE_MOUNT | ||
33 | #error Failed to locate mount(8)! | ||
34 | diff --git a/lib/log.c b/lib/log.c | ||
35 | index 39b1e3b..b99fa39 100644 | ||
36 | --- a/lib/log.c | ||
37 | +++ b/lib/log.c | ||
38 | @@ -368,3 +368,13 @@ pid_t log_pidinfo(struct autofs_point *ap, pid_t pid, char *label) { | ||
39 | |||
40 | return ppid; | ||
41 | } | ||
42 | + | ||
43 | +#ifndef __GLIBC__ | ||
44 | +# undef strerror_r | ||
45 | +char *autofs_strerror_r(int errnum, char *buf, size_t buflen) { | ||
46 | + int s = strerror_r(errnum, buf, buflen); | ||
47 | + if (s) | ||
48 | + return NULL; | ||
49 | + return buf; | ||
50 | +} | ||
51 | +#endif | ||
52 | -- | ||
53 | 2.37.3 | ||
54 | |||
diff --git a/meta-networking/recipes-daemons/autofs/autofs/0002-autofs-5.1.8-handle-innetgr-not-present-in-musl.patch b/meta-networking/recipes-daemons/autofs/autofs/0002-autofs-5.1.8-handle-innetgr-not-present-in-musl.patch new file mode 100644 index 000000000..9d0caae31 --- /dev/null +++ b/meta-networking/recipes-daemons/autofs/autofs/0002-autofs-5.1.8-handle-innetgr-not-present-in-musl.patch | |||
@@ -0,0 +1,106 @@ | |||
1 | From 1c0b0b70a276280f431d72319109a0bbc0267970 Mon Sep 17 00:00:00 2001 | ||
2 | From: Fabian Groffen <grobian@gentoo.org> | ||
3 | Date: Wed, 2 Feb 2022 10:15:22 +0800 | ||
4 | Subject: [PATCH 2/2] autofs-5.1.8 - handle innetgr() not present in musl | ||
5 | |||
6 | The function innetgr(3) may not be present in musl libc, add a check | ||
7 | for this. | ||
8 | |||
9 | Originally contributed by Fabian, modified by me. | ||
10 | |||
11 | Upstream-Status: Backport [https://git.kernel.org/pub/scm/linux/storage/autofs/autofs.git/commit/?id=f60e40af3c038b8955325a11b7294ad38c15c9e8] | ||
12 | Signed-off-by: Fabian Groffen <grobian@gentoo.org> | ||
13 | Signed-off-by: Ian Kent <raven@themaw.net> | ||
14 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
15 | --- | ||
16 | configure | 6 ++++++ | ||
17 | configure.in | 2 +- | ||
18 | include/config.h.in | 3 +++ | ||
19 | modules/parse_amd.c | 7 +++++++ | ||
20 | 4 files changed, 17 insertions(+), 1 deletion(-) | ||
21 | |||
22 | --- a/configure.in | ||
23 | +++ b/configure.in | ||
24 | @@ -169,7 +169,7 @@ AF_CHECK_SSS_LIB(SSS_AUTOFS, libsss_auto | ||
25 | AC_SUBST(HAVE_SSS_AUTOFS) | ||
26 | AC_SUBST(sssldir) | ||
27 | |||
28 | -AC_CHECK_FUNCS(pipe2) | ||
29 | +AC_CHECK_FUNCS(pipe2 innetgr) | ||
30 | |||
31 | # | ||
32 | # Newer mounts have the -s (sloppy) option to ignore unknown options, | ||
33 | --- a/include/config.h.in | ||
34 | +++ b/include/config.h.in | ||
35 | @@ -30,6 +30,9 @@ | ||
36 | /* Define to 1 if you have the `getservbyname' function. */ | ||
37 | #undef HAVE_GETSERVBYNAME | ||
38 | |||
39 | +/* Define to 1 if you have the `innetgr' function. */ | ||
40 | +#undef HAVE_INNETGR | ||
41 | + | ||
42 | /* Define to 1 if you have the <inttypes.h> header file. */ | ||
43 | #undef HAVE_INTTYPES_H | ||
44 | |||
45 | @@ -45,9 +48,6 @@ | ||
46 | /* Define if you have the Linux /proc filesystem. */ | ||
47 | #undef HAVE_LINUX_PROCFS | ||
48 | |||
49 | -/* Define to 1 if you have the <memory.h> header file. */ | ||
50 | -#undef HAVE_MEMORY_H | ||
51 | - | ||
52 | /* define if you have MOUNT */ | ||
53 | #undef HAVE_MOUNT | ||
54 | |||
55 | @@ -69,6 +69,9 @@ | ||
56 | /* Define to 1 if you have the <stdint.h> header file. */ | ||
57 | #undef HAVE_STDINT_H | ||
58 | |||
59 | +/* Define to 1 if you have the <stdio.h> header file. */ | ||
60 | +#undef HAVE_STDIO_H | ||
61 | + | ||
62 | /* Define to 1 if you have the <stdlib.h> header file. */ | ||
63 | #undef HAVE_STDLIB_H | ||
64 | |||
65 | @@ -141,7 +144,9 @@ | ||
66 | /* define if you have YACC */ | ||
67 | #undef PATH_YACC | ||
68 | |||
69 | -/* Define to 1 if you have the ANSI C header files. */ | ||
70 | +/* Define to 1 if all of the C90 standard headers exist (not just the ones | ||
71 | + required in a freestanding environment). This macro is provided for | ||
72 | + backward compatibility; new code need not use it. */ | ||
73 | #undef STDC_HEADERS | ||
74 | |||
75 | /* Define to 1 to use the libtirpc tsd usage workaround */ | ||
76 | --- a/modules/parse_amd.c | ||
77 | +++ b/modules/parse_amd.c | ||
78 | @@ -424,6 +424,7 @@ static int sel_in_network(struct autofs_ | ||
79 | return ret; | ||
80 | } | ||
81 | |||
82 | +#ifdef HAVE_INNETGR | ||
83 | static int sel_netgrp(struct autofs_point *ap, | ||
84 | struct selector *s, struct substvar *sv) | ||
85 | { | ||
86 | @@ -488,6 +489,7 @@ out: | ||
87 | |||
88 | return ret; | ||
89 | } | ||
90 | +#endif | ||
91 | |||
92 | static int eval_selector(struct autofs_point *ap, | ||
93 | struct amd_entry *this, struct substvar *sv) | ||
94 | @@ -627,7 +629,12 @@ static int eval_selector(struct autofs_p | ||
95 | switch (s->sel->selector) { | ||
96 | case SEL_NETGRP: | ||
97 | case SEL_NETGRPD: | ||
98 | +#ifndef HAVE_INNETGR | ||
99 | + error(logopt, MODPREFIX | ||
100 | + "netgroups not available, function innetgr(3) not available"); | ||
101 | +#else | ||
102 | ret = sel_netgrp(ap, s, sv); | ||
103 | +#endif | ||
104 | break; | ||
105 | |||
106 | default: | ||
diff --git a/meta-networking/recipes-daemons/autofs/autofs_5.1.8.bb b/meta-networking/recipes-daemons/autofs/autofs_5.1.8.bb index cb8084458..ca11f1a17 100644 --- a/meta-networking/recipes-daemons/autofs/autofs_5.1.8.bb +++ b/meta-networking/recipes-daemons/autofs/autofs_5.1.8.bb | |||
@@ -27,6 +27,8 @@ SRC_URI = "${KERNELORG_MIRROR}/linux/daemons/autofs/v5/autofs-${PV}.tar.gz \ | |||
27 | file://0001-Bug-fix-for-pid_t-not-found-on-musl.patch \ | 27 | file://0001-Bug-fix-for-pid_t-not-found-on-musl.patch \ |
28 | file://0001-Define-__SWORD_TYPE-if-undefined.patch \ | 28 | file://0001-Define-__SWORD_TYPE-if-undefined.patch \ |
29 | file://mount_conflict.patch \ | 29 | file://mount_conflict.patch \ |
30 | file://0001-autofs-5.1.8-add-autofs_strerror_r-helper-for-musl.patch \ | ||
31 | file://0002-autofs-5.1.8-handle-innetgr-not-present-in-musl.patch \ | ||
30 | " | 32 | " |
31 | SRC_URI[sha256sum] = "0bd401c56f0eb1ca6251344c3a3d70bface3eccf9c67117cd184422c4cace30c" | 33 | SRC_URI[sha256sum] = "0bd401c56f0eb1ca6251344c3a3d70bface3eccf9c67117cd184422c4cace30c" |
32 | 34 | ||