me
/
guix
Archived
1
0
Fork 0

gnu: glib-networking: Work around test failure on 32-bit platforms.

On 32-bit platforms with a 32-bit 'time_t', we'd get this test failure:

  GLib-Net:ERROR:../glib-networking-2.70.rc/tls/tests/certificate.c:689:test_certificate_not_valid_after: assertion failed (actual_str == EXPECTED_NOT_VALID_AFTER): ("2037-12-31T23:23:23Z" == "2046-07-25T18:13:10Z")

This commit includes the workaround implemented upstream.

* gnu/packages/patches/glib-networking-32-bit-time.patch: New file.
* gnu/local.mk (dist_patch_DATA): Add it.
* gnu/packages/gnome.scm (glib-networking)[arguments]: New field.
master
Ludovic Courtès 2021-11-24 18:22:08 +01:00
parent dda78c1de7
commit 3e810b846a
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5
3 changed files with 73 additions and 0 deletions

View File

@ -1129,6 +1129,7 @@ dist_patch_DATA = \
%D%/packages/patches/glade-test-widget-null-icon.patch \
%D%/packages/patches/glib-appinfo-watch.patch \
%D%/packages/patches/glib-networking-gnutls-binding.patch \
%D%/packages/patches/glib-networking-32-bit-time.patch \
%D%/packages/patches/glib-skip-failing-test.patch \
%D%/packages/patches/glibc-CVE-2018-11236.patch \
%D%/packages/patches/glibc-CVE-2018-11237.patch \

View File

@ -4845,6 +4845,17 @@ library.")
(patches
(search-patches "glib-networking-gnutls-binding.patch"))))
(build-system meson-build-system)
(arguments
(if (target-64bit?)
'()
(list #:phases
#~(modify-phases %standard-phases
(add-after 'unpack 'work-around-32-bit-time-t
(lambda _
(invoke "patch" "--force" "-p1" "-i"
#$(local-file
(search-patch
"glib-networking-32-bit-time.patch")))))))))
(native-inputs
`(("pkg-config" ,pkg-config)
("gettext" ,gettext-minimal)))

View File

@ -0,0 +1,61 @@
Work around a year-2038 issue when building with a 32-bit 'time_t'
on 32-bit platforms:
https://gitlab.gnome.org/GNOME/glib-networking/-/issues/172
From 4f8ca86a0e460794188c3355f0c7cc11fdbe4229 Mon Sep 17 00:00:00 2001
From: Simon McVittie <simon.mcvittie@collabora.co.uk>
Date: Tue, 21 Sep 2021 17:07:44 +0000
Subject: [PATCH] tests: Accept GNUTLS' workaround for limited size of time_t
---
tls/tests/certificate.c | 15 +++++++++++++++
tls/tests/meson.build | 1 +
2 files changed, 16 insertions(+)
diff --git a/tls/tests/certificate.c b/tls/tests/certificate.c
index c0100d30..d216c710 100644
--- a/tls/tests/certificate.c
+++ b/tls/tests/certificate.c
@@ -672,6 +672,12 @@ test_certificate_not_valid_before (void)
g_object_unref (cert);
}
+/* On 32-bit, GNUTLS caps expiry times at 2037-12-31 23:23:23 to avoid
+ * overflowing time_t. Hopefully by 2037, either 32-bit will finally have
+ * died out, or GNUTLS will rethink its approach to
+ * https://gitlab.com/gnutls/gnutls/-/issues/370 */
+#define GNUTLS_32_BIT_NOT_VALID_AFTER_MAX 2145914603
+
static void
test_certificate_not_valid_after (void)
{
@@ -686,7 +692,16 @@ test_certificate_not_valid_after (void)
actual = g_tls_certificate_get_not_valid_after (cert);
g_assert_nonnull (actual);
actual_str = g_date_time_format_iso8601 (actual);
+
+#if SIZEOF_TIME_T <= 4
+ if (g_date_time_to_unix (actual) == GNUTLS_32_BIT_NOT_VALID_AFTER_MAX)
+ g_test_incomplete ("not-valid-after date not representable on 32-bit");
+ else
+ g_assert_cmpstr (actual_str, ==, EXPECTED_NOT_VALID_AFTER);
+#else
g_assert_cmpstr (actual_str, ==, EXPECTED_NOT_VALID_AFTER);
+#endif
+
g_free (actual_str);
g_date_time_unref (actual);
g_object_unref (cert);
diff --git a/tls/tests/meson.build b/tls/tests/meson.build
index e9c7d8c6..7415f913 100644
--- a/tls/tests/meson.build
+++ b/tls/tests/meson.build
@@ -69,6 +69,7 @@ foreach backend: backends
test_cflags = cflags + [
'-DBACKEND="@0@"'.format(backend),
'-DBACKEND_IS_' + backend.to_upper(),
+ '-DSIZEOF_TIME_T=@0@'.format(cc.sizeof('time_t', prefix: '#include <time.h>')),
]
if backend == 'openssl'