Hello Paul,

I have seen a test failure when cross-compiling GnuTLS to mingw32 and
running the testsuites with Wine[1].  It looks like the library
mis-calculates timeout value for DTLS, because of a confusion in time_t
size detection.

The configure output shows some clue:

  checking for 64-bit time_t... no
  checking for 64-bit time_t with _TIME_BITS=64... no
  configure: WARNING: This package requires a 64-bit 'time_t' type if there is 
any way to access timestamps outside the year range 1901-2038 on your platform. 
Perhaps you should configure with 'CPPFLAGS="-m64" LDFLAGS="-m64"'?
  checking whether time_t is signed... yes
  checking size of time_t... 8

where I observe:

- AC_CHECK_SIZEOF reports time_t is 64-bit, as gl_YEAR2038_EARLY sets
  __MINGW_USE_VC2005_COMPAT

- gl_YEAR2038_BODY is called before gl_YEAR2038_EARLY as a dependency of
  AC_SYS_LARGEFILE

- Therefore checks in gl_YEAR2038_BODY are not affected by
  __MINGW_USE_VC2005_COMPAT and report that time_t is NOT 64-bit

I guess a simple solution would be to swap the order of
gl_YEAR2038_EARLY and AC_SYS_LARGEFILE in modules/largefile, as with the
attached patch.

This doesn't fully resolve the issue with DTLS tests as mentioned, and I
suspect there might be some other confusions.  Any suggestions would be
appreciated.

Footnotes:
[1]  https://gitlab.com/dueno/gnutls/-/jobs/2613997489

Regards,
-- 
Daiki Ueno
>From eac9e4fe9fd9e432bce8765059ae29559258344f Mon Sep 17 00:00:00 2001
From: Daiki Ueno <u...@gnu.org>
Date: Mon, 26 Sep 2022 13:48:42 +0900
Subject: [PATCH] largefile: fix detection of time_t size on mingw32

* modules/largefile (configure.ac-early): Ensure gl_YEAR2038_EARLY
is invoked before gl_YEAR2038_BODY.
---
 ChangeLog         | 6 ++++++
 modules/largefile | 2 +-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index 6027e5ed94..3b97909de5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2022-09-26  Daiki Ueno  <u...@gnu.org>
+
+	largefile: fix detection of time_t size on mingw32
+	* modules/largefile (configure.ac-early): Ensure gl_YEAR2038_EARLY
+	is invoked before gl_YEAR2038_BODY.
+
 2022-09-25  Paul Eggert  <egg...@cs.ucla.edu>
 
 	fts: fix errno handling if dirfd fails
diff --git a/modules/largefile b/modules/largefile
index 8eb438a8e9..9e1d9f052a 100644
--- a/modules/largefile
+++ b/modules/largefile
@@ -13,8 +13,8 @@ m4/year2038.m4
 Depends-on:
 
 configure.ac-early:
-AC_REQUIRE([AC_SYS_LARGEFILE])
 AC_REQUIRE([gl_YEAR2038_EARLY])
+AC_REQUIRE([AC_SYS_LARGEFILE])
 
 configure.ac:
 AC_REQUIRE([gl_LARGEFILE])
-- 
2.37.3

Reply via email to