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 /meta-networking/recipes-daemons | |
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>
Diffstat (limited to 'meta-networking/recipes-daemons')
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 0000000000..5fd9a8d129 --- /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 @@ +From 88f991b0ebb6fb8fcaad3d0eb8fb51a7439d053e Mon Sep 17 00:00:00 2001 +From: Fabian Groffen <grobian@gentoo.org> +Date: Wed, 2 Feb 2022 09:27:13 +0800 +Subject: [PATCH 1/2] autofs-5.1.8 - add autofs_strerror_r() helper for musl + +If using musl libc the XSI-compliant variant strerror_r() which returns +an integer instead of a pointer so add a helper function to handle this +case. + +Signed-off-by: Fabian Groffen <grobian@gentoo.org> +Signed-off-by: Ian Kent <raven@themaw.net> +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- + include/automount.h | 5 +++++ + lib/log.c | 10 ++++++++++ + 2 files changed, 15 insertions(+) + +diff --git a/include/automount.h b/include/automount.h +index 8cd8b3a..f759e59 100644 +--- a/include/automount.h ++++ b/include/automount.h +@@ -51,6 +51,11 @@ + # endif + #endif + ++#ifndef __GLIBC__ ++# define strerror_r(N,B,S) autofs_strerror_r(N,B,S) ++char *autofs_strerror_r(int errnum, char *buf, size_t buflen); /* GNU */ ++#endif ++ + /* We MUST have the paths to mount(8) and umount(8) */ + #ifndef HAVE_MOUNT + #error Failed to locate mount(8)! +diff --git a/lib/log.c b/lib/log.c +index 39b1e3b..b99fa39 100644 +--- a/lib/log.c ++++ b/lib/log.c +@@ -368,3 +368,13 @@ pid_t log_pidinfo(struct autofs_point *ap, pid_t pid, char *label) { + + return ppid; + } ++ ++#ifndef __GLIBC__ ++# undef strerror_r ++char *autofs_strerror_r(int errnum, char *buf, size_t buflen) { ++ int s = strerror_r(errnum, buf, buflen); ++ if (s) ++ return NULL; ++ return buf; ++} ++#endif +-- +2.37.3 + 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 0000000000..9d0caae312 --- /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 @@ +From 1c0b0b70a276280f431d72319109a0bbc0267970 Mon Sep 17 00:00:00 2001 +From: Fabian Groffen <grobian@gentoo.org> +Date: Wed, 2 Feb 2022 10:15:22 +0800 +Subject: [PATCH 2/2] autofs-5.1.8 - handle innetgr() not present in musl + +The function innetgr(3) may not be present in musl libc, add a check +for this. + +Originally contributed by Fabian, modified by me. + +Upstream-Status: Backport [https://git.kernel.org/pub/scm/linux/storage/autofs/autofs.git/commit/?id=f60e40af3c038b8955325a11b7294ad38c15c9e8] +Signed-off-by: Fabian Groffen <grobian@gentoo.org> +Signed-off-by: Ian Kent <raven@themaw.net> +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- + configure | 6 ++++++ + configure.in | 2 +- + include/config.h.in | 3 +++ + modules/parse_amd.c | 7 +++++++ + 4 files changed, 17 insertions(+), 1 deletion(-) + +--- a/configure.in ++++ b/configure.in +@@ -169,7 +169,7 @@ AF_CHECK_SSS_LIB(SSS_AUTOFS, libsss_auto + AC_SUBST(HAVE_SSS_AUTOFS) + AC_SUBST(sssldir) + +-AC_CHECK_FUNCS(pipe2) ++AC_CHECK_FUNCS(pipe2 innetgr) + + # + # Newer mounts have the -s (sloppy) option to ignore unknown options, +--- a/include/config.h.in ++++ b/include/config.h.in +@@ -30,6 +30,9 @@ + /* Define to 1 if you have the `getservbyname' function. */ + #undef HAVE_GETSERVBYNAME + ++/* Define to 1 if you have the `innetgr' function. */ ++#undef HAVE_INNETGR ++ + /* Define to 1 if you have the <inttypes.h> header file. */ + #undef HAVE_INTTYPES_H + +@@ -45,9 +48,6 @@ + /* Define if you have the Linux /proc filesystem. */ + #undef HAVE_LINUX_PROCFS + +-/* Define to 1 if you have the <memory.h> header file. */ +-#undef HAVE_MEMORY_H +- + /* define if you have MOUNT */ + #undef HAVE_MOUNT + +@@ -69,6 +69,9 @@ + /* Define to 1 if you have the <stdint.h> header file. */ + #undef HAVE_STDINT_H + ++/* Define to 1 if you have the <stdio.h> header file. */ ++#undef HAVE_STDIO_H ++ + /* Define to 1 if you have the <stdlib.h> header file. */ + #undef HAVE_STDLIB_H + +@@ -141,7 +144,9 @@ + /* define if you have YACC */ + #undef PATH_YACC + +-/* Define to 1 if you have the ANSI C header files. */ ++/* Define to 1 if all of the C90 standard headers exist (not just the ones ++ required in a freestanding environment). This macro is provided for ++ backward compatibility; new code need not use it. */ + #undef STDC_HEADERS + + /* Define to 1 to use the libtirpc tsd usage workaround */ +--- a/modules/parse_amd.c ++++ b/modules/parse_amd.c +@@ -424,6 +424,7 @@ static int sel_in_network(struct autofs_ + return ret; + } + ++#ifdef HAVE_INNETGR + static int sel_netgrp(struct autofs_point *ap, + struct selector *s, struct substvar *sv) + { +@@ -488,6 +489,7 @@ out: + + return ret; + } ++#endif + + static int eval_selector(struct autofs_point *ap, + struct amd_entry *this, struct substvar *sv) +@@ -627,7 +629,12 @@ static int eval_selector(struct autofs_p + switch (s->sel->selector) { + case SEL_NETGRP: + case SEL_NETGRPD: ++#ifndef HAVE_INNETGR ++ error(logopt, MODPREFIX ++ "netgroups not available, function innetgr(3) not available"); ++#else + ret = sel_netgrp(ap, s, sv); ++#endif + break; + + 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 cb80844586..ca11f1a170 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 \ file://0001-Bug-fix-for-pid_t-not-found-on-musl.patch \ file://0001-Define-__SWORD_TYPE-if-undefined.patch \ file://mount_conflict.patch \ + file://0001-autofs-5.1.8-add-autofs_strerror_r-helper-for-musl.patch \ + file://0002-autofs-5.1.8-handle-innetgr-not-present-in-musl.patch \ " SRC_URI[sha256sum] = "0bd401c56f0eb1ca6251344c3a3d70bface3eccf9c67117cd184422c4cace30c" |