commit:     0a9dcd47814bfdc36c92de4e57071ad692fd4480
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon Nov 29 05:30:13 2021 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Nov 29 05:30:25 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0a9dcd47

net-libs/glib-networking: apply upstream patch for 32-bit test failure

Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../glib-networking-2.70.0-time_t-32-bit.patch     | 52 ++++++++++++++++++++++
 .../glib-networking/glib-networking-2.70.0.ebuild  |  4 ++
 2 files changed, 56 insertions(+)

diff --git 
a/net-libs/glib-networking/files/glib-networking-2.70.0-time_t-32-bit.patch 
b/net-libs/glib-networking/files/glib-networking-2.70.0-time_t-32-bit.patch
new file mode 100644
index 000000000000..fc9ccea13952
--- /dev/null
+++ b/net-libs/glib-networking/files/glib-networking-2.70.0-time_t-32-bit.patch
@@ -0,0 +1,52 @@
+Workaround/fix test failure on 32-bit arches. Should be in release
+after 2.70.0.
+
+https://gitlab.gnome.org/GNOME/glib-networking/-/commit/4f8ca86a0e460794188c3355f0c7cc11fdbe4229.patch
+
+From: Simon McVittie <[email protected]>
+Date: Tue, 21 Sep 2021 17:07:44 +0000
+Subject: [PATCH] tests: Accept GNUTLS' workaround for limited size of time_t
+
+--- 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);
+--- 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'
+GitLab

diff --git a/net-libs/glib-networking/glib-networking-2.70.0.ebuild 
b/net-libs/glib-networking/glib-networking-2.70.0.ebuild
index 860454cb0242..8bdcf6b9b5c7 100644
--- a/net-libs/glib-networking/glib-networking-2.70.0.ebuild
+++ b/net-libs/glib-networking/glib-networking-2.70.0.ebuild
@@ -30,6 +30,10 @@ BDEPEND="
        test? ( sys-apps/dbus )
 "
 
+PATCHES=(
+       "${FILESDIR}"/${P}-time_t-32-bit.patch
+)
+
 src_prepare() {
        xdg_src_prepare
 

Reply via email to