xinetd: Pass missing -D_GNU_SOURCE
PATCH 1/7 xinetd: Pass missing -D_GNU_SOURCE
We do not get proper function definitions otherwise e.g. fcvt()
--- meta/recipes-extended/xinetd/xinetd_2.3.15.4.bb | 2 ++ 1 file changed, 2 insertions(+)
meta/recipes-extended/xinetd/xinetd_2.3.15.4.bb +2 -0
@@ -30,6 +30,8 @@ INITSCRIPT_PARAMS = "defaults" PACKAGECONFIG ??= "tcp-wrappers" PACKAGECONFIG[tcp-wrappers] = "--with-libwrap,,tcp-wrappers" +CFLAGS += "-D_GNU_SOURCE" + CONFFILES:${PN} = "${sysconfdir}/xinetd.conf" do_install:append() {
Signature · 1 line
2.37.2
PATCH 2/7 watchdog: Include needed system header for function decls
These headers are needed on musl too.
--- ...guard-sys-quota.h-sys-swap.h-and-sys.patch | 37 +++++++++++++++++++ .../watchdog/watchdog_5.16.bb | 1 + 2 files changed, 38 insertions(+) create mode 100644 meta/recipes-extended/watchdog/watchdog/0001-shutdown-Do-not-guard-sys-quota.h-sys-swap.h-and-sys.patch
meta/recipes-extended/watchdog/watchdog/0001-shutdown-Do-not-guard-sys-quota.h-sys-swap.h-and-sys.patch new file +37 -0
@@ -0,0 +1,37 @@ +From ca1d379fa13c4055d42d2ff3a647b4397768efcd Mon Sep 17 00:00:00 2001 +From: Khem Raj <[email protected]> +Date: Tue, 23 Aug 2022 19:23:26 -0700 +Subject: [PATCH] shutdown: Do not guard sys/quota.h sys/swap.h and + sys/reboot.h with __GLIBC__ + +These headers are provided by uclibc/musl/glibc and bionic so we can +assume they are not needed to be glibc specific includes. This also +ensures that we get proper declaration of reboot() API + +Upstream-Status: Submitted [https://sourceforge.net/p/watchdog/patches/12/] +Signed-off-by: Khem Raj <[email protected]> +--- + src/shutdown.c | 4 ---- + 1 file changed, 4 deletions(-) + +diff --git a/src/shutdown.c b/src/shutdown.c +index 1d9a857..6aea0d0 100644 +--- a/src/shutdown.c ++++ b/src/shutdown.c +@@ -29,13 +29,9 @@ + #include "extern.h" + #include "ext2_mnt.h" + +-#if defined __GLIBC__ + #include <sys/quota.h> + #include <sys/swap.h> + #include <sys/reboot.h> +-#else /* __GLIBC__ */ +-#include <linux/quota.h> +-#endif /* __GLIBC__ */ + + #include <unistd.h> + +-- +2.37.2 +
meta/recipes-extended/watchdog/watchdog_5.16.bb +1 -0
@@ -13,6 +13,7 @@ SRC_URI = "${SOURCEFORGE_MIRROR}/watchdog/watchdog-${PV}.tar.gz \ file://watchdog.init \ file://wd_keepalive.init \ file://0001-wd_keepalive.service-use-run-instead-of-var-run.patch \ + file://0001-shutdown-Do-not-guard-sys-quota.h-sys-swap.h-and-sys.patch \ " SRC_URI[md5sum] = "1b4f51cabc64d1bee2fce7cdd626831f"
Signature · 1 line
2.37.2
PATCH 3/7 libcgroup: Use GNU strerror_r only when its available
In reply to Khem RajThis patch ensures that a fallback to use XSI compliant strerror_r when GNU extention is not implemented, which fixes the case when building with musl
--- ...pi-Use-GNU-strerror_r-when-available.patch | 55 +++++++++++++++++++ .../recipes-core/libcgroup/libcgroup_3.0.0.bb | 4 +- 2 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 meta/recipes-core/libcgroup/libcgroup/0001-api-Use-GNU-strerror_r-when-available.patch
meta/recipes-core/libcgroup/libcgroup/0001-api-Use-GNU-strerror_r-when-available.patch new file +55 -0
@@ -0,0 +1,55 @@ +From d190c0c548b3219b75e4c399aa89186e77bbe270 Mon Sep 17 00:00:00 2001 +From: Khem Raj <[email protected]> +Date: Tue, 23 Aug 2022 20:03:09 -0700 +Subject: [PATCH] api: Use GNU strerror_r when available + +GNU strerror_r is only available in glibc, musl impelents the XSI +version which is slightly different, therefore check if GNU version is +available before using it, otherwise use the XSI compliant version. + +Upstream-Status: Submitted [https://github.com/libcgroup/libcgroup/pull/236] +Signed-off-by: Khem Raj <[email protected]> +--- + configure.ac | 5 +++++ + src/api.c | 8 ++++++-- + 2 files changed, 11 insertions(+), 2 deletions(-) + +diff --git a/configure.ac b/configure.ac +index b68c655..831866d 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -183,6 +183,11 @@ AC_FUNC_REALLOC + AC_FUNC_STAT + AC_CHECK_FUNCS([getmntent hasmntopt memset mkdir rmdir strdup]) + ++orig_CFLAGS="$CFLAGS" ++CFLAGS="$CFLAGS -D_GNU_SOURCE" ++AC_FUNC_STRERROR_R ++CFLAGS="$orig_CFLAGS" ++ + AC_SEARCH_LIBS( + [fts_open], + [fts], +diff --git a/src/api.c b/src/api.c +index 5c6de11..06aa1d6 100644 +--- a/src/api.c ++++ b/src/api.c +@@ -4571,9 +4571,13 @@ const char *cgroup_strerror(int code) + { + int idx = code % ECGROUPNOTCOMPILED; + +- if (code == ECGOTHER) ++ if (code == ECGOTHER) { ++#ifdef STRERROR_R_CHAR_P + return strerror_r(cgroup_get_last_errno(), errtext, MAXLEN); +- ++#else ++ return strerror_r(cgroup_get_last_errno(), errtext, sizeof (errtext)) ? "unknown error" : errtext; ++#endif ++ } + if (idx >= sizeof(cgroup_strerror_codes)/sizeof(cgroup_strerror_codes[0])) + return "Invalid error code"; + +-- +2.37.2 +
meta/recipes-core/libcgroup/libcgroup_3.0.0.bb +3 -1
@@ -11,7 +11,9 @@ inherit autotools pkgconfig DEPENDS = "bison-native flex-native" -SRC_URI = "https://github.com/${BPN}/${BPN}/releases/download/v3.0/${BP}.tar.gz" +SRC_URI = "https://github.com/${BPN}/${BPN}/releases/download/v3.0/${BP}.tar.gz \ + file://0001-api-Use-GNU-strerror_r-when-available.patch \ +" SRC_URI[sha256sum] = "8d284d896fca1c981b55850e92acd3ad9648a69227c028dda7ae3402af878edd" UPSTREAM_CHECK_URI = "https://github.com/libcgroup/libcgroup/releases/"
Signature · 1 line
2.37.2
PATCH 4/7 enable _XOPEN_SOURCE on musl for wchar usage in curses
In reply to Khem RajThis is defined for glibc automatically with _GNU_SOURCE but not for musl
--- meta/recipes-support/pinentry/pinentry_1.2.0.bb | 3 +++ 1 file changed, 3 insertions(+)
meta/recipes-support/pinentry/pinentry_1.2.0.bb +3 -0
@@ -32,5 +32,8 @@ PACKAGECONFIG[secret] = "--enable-libsecret, --disable-libsecret, libsecret" EXTRA_OECONF = " \ --disable-rpath \ " +EXTRA_OECONF:append:libc-musl = " \ + ac_cv_should_define__xopen_source=yes \ +" BBCLASSEXTEND = "native nativesdk"
Signature · 1 line
2.37.2
Re: [OE-core] [PATCH 4/7] enable _XOPEN_SOURCE on musl for wchar usage in curses
Hi Mhem,
Quoted 4 lines · On Tue, 23 Aug 2022 23:34:40 -0700 "Khem Raj" <[email protected]> wrote:
This is defined for glibc automatically with
_GNU_SOURCEbut not for muslSigned-off-by Khem Raj <[email protected]>
Missing 'pinentry: ' subject prefix. I added it when taking the patch on my testing branch, no need to resend.
Signature · 3 lines
Luca Ceresoli, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
Re: [OE-core] [PATCH 4/7] enable _XOPEN_SOURCE on musl for wchar usage in curses
Quoted 6 lines · Luca Ceresoli
Hi Mhem,
On Tue, 23 Aug 2022 23:34:40 -0700
"Khem Raj" <[email protected]> wrote:
Quoted 8 lines
Quoted 4 lines
This is defined for glibc automatically with
_GNU_SOURCEbut not for muslSigned-off-by Khem Raj <[email protected]>Missing 'pinentry: ' subject prefix. I added it when taking the patch on my testing branch, no need to resend.
ah thanks for help Luca.
Quoted 4 lines
--
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
PATCH 5/7 apr: Use correct strerror_r implementation based on libc type
In reply to Khem Rajmusl does not implement GNU extention of strerror_r but XSI compliant version, therefore add it via a packageconfig to set right variables during configure to cache the value.
configure detection logic depends on runtime test which will always be wrong on cross compiles therefore backport a patch to make it possible to cache the needed configure variable.
--- ...CHE_CHECK-for-strerror_r-return-type.patch | 52 +++++++++++++++++++ meta/recipes-support/apr/apr_1.7.0.bb | 4 ++ 2 files changed, 56 insertions(+) create mode 100644 meta/recipes-support/apr/apr/0001-add-AC_CACHE_CHECK-for-strerror_r-return-type.patch
meta/recipes-support/apr/apr/0001-add-AC_CACHE_CHECK-for-strerror_r-return-type.patch new file +52 -0
@@ -0,0 +1,52 @@ +From 8ca3c3306f1a149e51a3be6a4b1e47e9aee88262 Mon Sep 17 00:00:00 2001 +From: Khem Raj <[email protected]> +Date: Tue, 23 Aug 2022 22:42:03 -0700 +Subject: [PATCH] add AC_CACHE_CHECK for strerror_r return type + +APR's configure script uses AC_TRY_RUN to detect whether the return type +of strerror_r is int. When cross-compiling this defaults to no. + +This commit adds an AC_CACHE_CHECK so users who cross-compile APR may +influence the outcome with a configure variable. + +Upstream-Status: Backport [https://svn.apache.org/viewvc?view=revision&revision=1875065] +Signed-off-by: Khem Raj <[email protected]> +--- + build/apr_common.m4 | 11 ++++------- + 1 file changed, 4 insertions(+), 7 deletions(-) + +diff --git a/build/apr_common.m4 b/build/apr_common.m4 +index cbf2a4c..42e75cf 100644 +--- a/build/apr_common.m4 ++++ b/build/apr_common.m4 +@@ -525,8 +525,9 @@ dnl string. + dnl + dnl + AC_DEFUN([APR_CHECK_STRERROR_R_RC], [ +-AC_MSG_CHECKING(for type of return code from strerror_r) +-AC_TRY_RUN([ ++AC_CACHE_CHECK([whether return code from strerror_r has type int], ++[ac_cv_strerror_r_rc_int], ++[AC_TRY_RUN([ + #include <errno.h> + #include <string.h> + #include <stdio.h> +@@ -542,14 +543,10 @@ main() + }], [ + ac_cv_strerror_r_rc_int=yes ], [ + ac_cv_strerror_r_rc_int=no ], [ +- ac_cv_strerror_r_rc_int=no ] ) ++ ac_cv_strerror_r_rc_int=no ] ) ] ) + if test "x$ac_cv_strerror_r_rc_int" = xyes; then + AC_DEFINE(STRERROR_R_RC_INT, 1, [Define if strerror returns int]) +- msg="int" +-else +- msg="pointer" + fi +-AC_MSG_RESULT([$msg]) + ] ) + + dnl +-- +2.37.2 +
meta/recipes-support/apr/apr_1.7.0.bb +4 -0
@@ -24,6 +24,7 @@ SRC_URI = "${APACHE_MIRROR}/apr/${BPN}-${PV}.tar.bz2 \ file://libtoolize_check.patch \ file://0001-Add-option-to-disable-timed-dependant-tests.patch \ file://autoconf270.patch \ + file://0001-add-AC_CACHE_CHECK-for-strerror_r-return-type.patch \ file://CVE-2021-35940.patch \ "
@@ -44,9 +45,12 @@ CACHED_CONFIGUREVARS += "ac_cv_header_netinet_sctp_h=no ac_cv_header_netinet_sct CACHED_CONFIGUREVARS += "ac_cv_sizeof_struct_iovec=yes" CACHED_CONFIGUREVARS += "ac_cv_file__dev_zero=yes" +CACHED_CONFIGUREVARS:append:libc-musl = " ac_cv_strerror_r_rc_int=yes" PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'ipv6', d)}" +PACKAGECONFIG:append:libc-musl = " xsi-strerror" PACKAGECONFIG[ipv6] = "--enable-ipv6,--disable-ipv6," PACKAGECONFIG[timed-tests] = "--enable-timed-tests,--disable-timed-tests," +PACKAGECONFIG[xsi-strerror] = "ac_cv_strerror_r_rc_int=yes,ac_cv_strerror_r_rc_int=no," do_configure:prepend() { # Avoid absolute paths for grep since it causes failures
Signature · 1 line
2.37.2
PATCH 6/7 gcr: Define _GNU_SOURCE
In reply to Khem RajThis ensures that definitions of functions e.g. getpass() are correctly sourced from system headers, since it depends on feature test macros
--- meta/recipes-gnome/gcr/gcr_3.40.0.bb | 2 ++ 1 file changed, 2 insertions(+)
meta/recipes-gnome/gcr/gcr_3.40.0.bb +2 -0
@@ -13,6 +13,8 @@ DEPENDS = "p11-kit glib-2.0 libgcrypt gnupg-native \ CACHED_CONFIGUREVARS += "ac_cv_path_GPG='gpg2'" +CFLAGS += "-D_GNU_SOURCE" + GNOMEBASEBUILDCLASS = "meson" GTKDOC_MESON_OPTION = "gtk_doc" inherit gnomebase gtk-icon-cache gtk-doc features_check upstream-version-is-even vala gobject-introspection gettext mime mime-xdg
Signature · 1 line
2.37.2
PATCH 7/7 ltp: Adjust types to match create_fifo_thread return
In reply to Khem RajFixes build on musl
--- ...nt-instead-of-pthread_t-for-thread-I.patch | 36 +++++++++++++++++++ meta/recipes-extended/ltp/ltp_20220527.bb | 1 + 2 files changed, 37 insertions(+) create mode 100644 meta/recipes-extended/ltp/ltp/0001-rt-migrate-Use-int-instead-of-pthread_t-for-thread-I.patch
meta/recipes-extended/ltp/ltp/0001-rt-migrate-Use-int-instead-of-pthread_t-for-thread-I.patch new file +36 -0
@@ -0,0 +1,36 @@ +From 11e503344c36c1c7df3e455d81736dc4a5b43775 Mon Sep 17 00:00:00 2001 +From: Khem Raj <[email protected]> +Date: Tue, 23 Aug 2022 23:20:53 -0700 +Subject: [PATCH] rt-migrate: Use int instead of pthread_t for thread IDs + +pthread_t is opaque, but create_fifo_thread() returns integer therefore +on musl where thread_t is not integer, this fails to compile e.g. + +| rt-migrate.c:450:14: error: incompatible integer to pointer conversion assigning to 'pthread_t' (aka 'struct __pthread *') from 'int' [-Wint-conversion] +| threads[i] = create_fifo_thread(start_task, (void *)i, +| ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Align the types used to fix the problems. + +Upstream-Status: Submitted [https://lists.linux.it/pipermail/ltp/2022-August/030239.html] +Signed-off-by: Khem Raj <[email protected]> +--- + testcases/realtime/func/rt-migrate/rt-migrate.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/testcases/realtime/func/rt-migrate/rt-migrate.c b/testcases/realtime/func/rt-migrate/rt-migrate.c +index 3e6c82a2fb..97ab604c7f 100644 +--- a/testcases/realtime/func/rt-migrate/rt-migrate.c ++++ b/testcases/realtime/func/rt-migrate/rt-migrate.c +@@ -394,7 +394,7 @@ static void stop_log(int sig) + + int main(int argc, char **argv) + { +- pthread_t *threads; ++ int *threads; + long i; + int ret; + struct timespec intv; +-- +2.37.2 +
meta/recipes-extended/ltp/ltp_20220527.bb +1 -0
@@ -39,6 +39,7 @@ SRC_URI = "git://github.com/linux-test-project/ltp.git;branch=master;protocol=ht file://0001-memcg-functional-Fix-usage-of-PAGESIZE-from-memcg_li.patch \ file://0001-lapi-pidfd-adding-pidfd-header-file.patch \ file://0001-lapi-fsmount-resolve-conflict-in-different-header-fi.patch \ + file://0001-rt-migrate-Use-int-instead-of-pthread_t-for-thread-I.patch \ " S = "${WORKDIR}/git"
Signature · 1 line
2.37.2