From 86553e7d0a1a2e8c5ecedc724fe37eb106ba957e Mon Sep 17 00:00:00 2001 From: maxice8 Date: Fri, 26 Jan 2018 22:30:26 -0200 Subject: [PATCH] elogind: import upstream musl fixes for test-hexdecot and test-parse-util. Closes: #11109 [via git-merge-pr] --- ...ble-compilation-of-musl-failing-test.patch | 18 --------- .../elogind/patches/fix-test-hexdecot.patch | 37 +++++++++++++++++++ .../elogind/patches/fix-test-parse-util.patch | 14 +++++++ srcpkgs/elogind/template | 2 +- 4 files changed, 52 insertions(+), 19 deletions(-) delete mode 100644 srcpkgs/elogind/patches/disable-compilation-of-musl-failing-test.patch create mode 100644 srcpkgs/elogind/patches/fix-test-hexdecot.patch create mode 100644 srcpkgs/elogind/patches/fix-test-parse-util.patch diff --git a/srcpkgs/elogind/patches/disable-compilation-of-musl-failing-test.patch b/srcpkgs/elogind/patches/disable-compilation-of-musl-failing-test.patch deleted file mode 100644 index 49951dd5c98..00000000000 --- a/srcpkgs/elogind/patches/disable-compilation-of-musl-failing-test.patch +++ /dev/null @@ -1,18 +0,0 @@ ---- src/test/meson.build -+++ src/test/meson.build -@@ -198,10 +198,11 @@ tests += [ - [], - []], - -- [['src/test/test-hexdecoct.c'], -- [], -- []], -- -+#if 0 /// FAILS TO COMPILE ON MUSL LIBC SYSTEMS -+# [['src/test/test-hexdecoct.c'], -+# [], -+# []], -+#endif //0 - [['src/test/test-alloc-util.c'], - [], - []], diff --git a/srcpkgs/elogind/patches/fix-test-hexdecot.patch b/srcpkgs/elogind/patches/fix-test-hexdecot.patch new file mode 100644 index 00000000000..9f3fd78c9b1 --- /dev/null +++ b/srcpkgs/elogind/patches/fix-test-hexdecot.patch @@ -0,0 +1,37 @@ +--- src/shared/musl_missing.h ++++ src/shared/musl_missing.h +@@ -55,13 +55,14 @@ extern char *program_invocation_short_name; + + /* strndupa may already be defined in another compatibility header */ + #if !defined(strndupa) +-#define strndupa(src, n) \ +- (__extension__ ({const char *in = (src); \ +- size_t len = strnlen(in, (n)) + 1; \ +- char *out = (char *) alloca(len); \ +- out[len-1] = '\0'; \ +- (char *) memcpy(out, in, len-1);}) \ +- ) ++#define strndupa(x_src, x_n) \ ++ (__extension__ ( { \ ++ const char* x_in = (x_src); \ ++ size_t x_len = strnlen(x_in, (x_n)) + 1; \ ++ char* x_out = (char *) alloca(x_len); \ ++ x_out[x_len-1] = '\0'; \ ++ (char *) memcpy(x_out, x_in, x_len-1); \ ++ } ) ) + #endif + + /* See http://man7.org/linux/man-pages/man3/canonicalize_file_name.3.html */ +--- src/test/test-hexdecoct.c ++++ src/test/test-hexdecoct.c +@@ -22,6 +22,9 @@ + #include "macro.h" + #include "string-util.h" + ++/// Additional includes needed by elogind ++#include "musl_missing.h" ++ + static void test_hexchar(void) { + assert_se(hexchar(0xa) == 'a'); + assert_se(hexchar(0x0) == '0'); + diff --git a/srcpkgs/elogind/patches/fix-test-parse-util.patch b/srcpkgs/elogind/patches/fix-test-parse-util.patch new file mode 100644 index 00000000000..b5292d320cd --- /dev/null +++ b/srcpkgs/elogind/patches/fix-test-parse-util.patch @@ -0,0 +1,14 @@ +--- src/test/test-parse-util.c ++++ src/test/test-parse-util.c +@@ -526,7 +526,10 @@ static void test_safe_atod(void) { + assert_se(r == -EINVAL); + + errno = 0; ++/// elogind supports musl_libc, and their strtod doesn't seem to use the set locale. ++#if defined(__GLIBC__) + assert_se(fabs(strtod("0,5", &e) - 0.5) < 0.00001); ++#endif // __GLIBC__ + } + + /* And check again, reset */ + diff --git a/srcpkgs/elogind/template b/srcpkgs/elogind/template index 72b58352baf..b5daee3d748 100644 --- a/srcpkgs/elogind/template +++ b/srcpkgs/elogind/template @@ -1,7 +1,7 @@ # Template file for 'elogind' pkgname=elogind version=235.2 -revision=2 +revision=3 build_style=meson hostmakedepends="intltool pkg-config gperf docbook-xsl gettext-devel shadow m4 libxslt git" makedepends="libcap-devel libmount-devel libseccomp-devel libblkid-devel pam-devel gettext-devel eudev-libudev-devel acl-devel glib-devel"