Subject: Re: [bug#71993] [PATCH core-updates 0/2] Don't use libfaketime for key package tests on 32bit systems

From: Zheng Junjie <[email-masked]>
Date: Sun, 21 Jul 2024 09:03:36 +0800

Christopher Baines <[email-masked]> writes:

> As it fails to build and seems broken.
>
>
> Christopher Baines (2):
>   gnu: nss: Don't use libfaketime on 32bit systems.
>   gnu: python-pyopenssl: Don't use libfaketime on 32bit systems.
>
>  gnu/packages/nss.scm           | 15 +++++++++++++--
>  gnu/packages/python-crypto.scm | 10 ++++++++--
>  2 files changed, 21 insertions(+), 4 deletions(-)

libfaketime is actually good, it just fails the test because coreutils
uses 64bit time_t.
gnulib will enable 64bit time_t on 32bit platforms, but we don't
currently support this, mixed abi will cause many problems[1], so turning
off 64bit time_t on coreutils can fix libfaketime's tests, and nss can
also use libfaketime because they use same time_t.

And libfaketime is not provided 64-bit time_t support on 32-bit archs,
see https://github.com/wolfcw/libfaketime/issues/418

We need to open a new branch to migrate time64 later

And see also

https://wiki.gentoo.org/wiki/Project:Toolchain/time64_migration
https://wiki.debian.org/ReleaseGoals/64bit-time

[1] https://bugs.gentoo.org/828001

From 5cbb346385201fb6fce1057a13a49c7977e9dd34 Mon Sep 17 00:00:00 2001
Message-ID: <5cb[email-masked]>
From: Zheng Junjie <[email-masked]>
Date: Sat, 20 Jul 2024 22:35:27 +0800
Subject: [PATCH 1/2] Revert "gnu: libfaketime: Support compilation with glibc
 2.39 on i686-linux."

This reverts commit 127f1842fb037cc5acfc5406e373ccd723127732.
---
 gnu/packages/check.scm | 38 +++-----------------------------------
 1 file changed, 3 insertions(+), 35 deletions(-)

diff --git a/gnu/packages/check.scm b/gnu/packages/check.scm
index 70f828b2a1..0ec375069e 100644
--- a/gnu/packages/check.scm
+++ b/gnu/packages/check.scm
@@ -26,7 +26,7 @@
 ;;; Copyright © 2017 Nikita <[email-masked]>
 ;;; Copyright © 2015, 2017, 2018, 2020, 2021, 2023, 2024 Ricardo Wurmus <[email-masked]>
 ;;; Copyright © 2016-2022 Marius Bakke <[email-masked]>
-;;; Copyright © 2017-2018, 2020-2021, 2024 Ludovic Courtès <[email-masked]>
+;;; Copyright © 2017, 2018, 2020, 2021 Ludovic Courtès <[email-masked]>
 ;;; Copyright © 2018 Fis Trivial <[email-masked]>
 ;;; Copyright © 2019, 2021 Pierre Langlois <[email-masked]>
 ;;; Copyright © 2019 Chris Marusich <[email-masked]>
@@ -3478,32 +3478,6 @@ (define-public libfaketime
               (substitute* "src/faketime.c"
                 (("\"date\"")
                  (format #f "~s" (search-input-file inputs "bin/date"))))))
-
-          #$@(if (target-64bit?)
-                 #~()
-                 #~((add-after 'unpack 'switch-libc-call
-                      (lambda _
-                        (substitute* "src/libfaketime.c"
-                          (("#define _GNU_SOURCE")
-                           ;; Make sure to use the 64-bit 'struct timespec' in
-                           ;; replacement functions.
-                           (string-append "#define _GNU_SOURCE\n"
-                                          "#define _FILE_OFFSET_BITS 64\n"
-                                          "#define _TIME_BITS 64\n"))
-                          (("\"__clock_gettime\"")
-                           ;; Replace '__clock_gettime64' rather than
-                           ;; '__clock_gettime64' since this is what
-                           ;; newly-built applications use.
-                           "\"__clock_gettime64\""))
-
-                        ;; XXX: Turn off 'pthread_cond_timedwait' etc.: tests
-                        ;; related to this are failing and this feature is
-                        ;; probably not useful for the purposes of running
-                        ;; code at a fixed date.
-                        (substitute* "src/Makefile"
-                          (("-DFAKE_PTHREAD")
-                           ""))))))
-
           (replace 'configure
             (lambda* (#:key outputs #:allow-other-keys)
               (setenv "CC" #$(cc-for-target))
@@ -3522,14 +3496,8 @@ (define-public libfaketime
           (add-before 'check 'pre-check
             (lambda _
               (substitute* "test/functests/test_exclude_mono.sh"
-                (("/bin/bash") (which "bash")))
-              #$@(if (target-64bit?)
-                     #~()
-                     ;; XXX: This test uses Perl to call 'clock_gettime' and
-                     ;; fails for unclear reasons on i686-linux.
-                     #~((delete-file
-                         "test/functests/test_exclude_mono.sh"))))))))
-    (native-inputs (list perl))                   ;for tests
+                (("/bin/bash") (which "bash"))))))))
+    (native-inputs (list perl))         ;for tests
     (inputs (list coreutils-minimal))
     (synopsis "Fake the system time for single applications")
     (description

base-commit: 3f15785c71eb82832ac0520c762a18a51861a141
-- 
2.45.2

From 273c1c1189d824b86ae531bd1b5df601f0e7e838 Mon Sep 17 00:00:00 2001
Message-ID: <273[email-masked]>
In-Reply-To: <5cb[email-masked]>
References: <5cb[email-masked]>
From: Zheng Junjie <[email-masked]>
Date: Sun, 21 Jul 2024 08:36:28 +0800
Subject: [PATCH 2/2] gnu: coreutils: Disable 64bit time_t on 32bit platform.

* gnu/packages/nss.scm (nss)[arguments]<#:configure-flags>: Pass
gl_cv_type_time_t_bits_macro=no on 32bit platform.

Change-Id: I3ba9e21733727a41f2070a27ccba39c9d5f2d406
---
 gnu/packages/base.scm | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/gnu/packages/base.scm b/gnu/packages/base.scm
index bc30d73426..47488c1603 100644
--- a/gnu/packages/base.scm
+++ b/gnu/packages/base.scm
@@ -471,6 +471,13 @@ (define-public coreutils
                                    " test-renameatu"
                                    " test-utimensat")))
             '())
+      ,@(if (target-64bit?)
+            '()
+            ;; We currently do not support 64-bit time_t on 32-bit platforms,
+            ;; mixing different bits of time_t will cause a lot of problems
+            ;; so forcibly disable it.
+            ;; see https://wiki.gentoo.org/wiki/Project:Toolchain/time64_migration
+            '(#:configure-flags (list "gl_cv_type_time_t_bits_macro=no")))
       #:phases (modify-phases %standard-phases
                  (add-before 'build 'patch-shell-references
                    (lambda _
-- 
2.45.2