all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#72239: libfaketime (still) broken on i686-linux
@ 2024-07-21 22:21 Ludovic Courtès
  2024-07-22  7:08 ` Ludovic Courtès
  0 siblings, 1 reply; 7+ messages in thread
From: Ludovic Courtès @ 2024-07-21 22:21 UTC (permalink / raw)
  To: 72239; +Cc: Christopher Baines, Z572

[-- Attachment #1: Type: text/plain, Size: 2230 bytes --]

Hi,

This bug report is to keep track of the discussions around libfaketime
for i686-linux.  Right now, libfaketime segfaults when used to run the
test suite of ‘nss’ on i686-linux.  This can be reproduced in a simple
way as of ‘core-updates’ commit
05e6bd3efe1b03190839d2b91b09fa768c4ef83c:

--8<---------------cut here---------------start------------->8---
$ ./pre-inst-env guix shell -s i686-linux libfaketime bash -- \
     faketime 2023-01-01 bash -c true
Caught Segmentation fault
--8<---------------cut here---------------end--------------->8---

Commit 127f1842fb037cc5acfc5406e373ccd723127732 (“gnu: libfaketime:
Support compilation with glibc 2.39 on i686-linux.”) was written under
the assumption that packages in Guix would be built with
‘_TIME_BITS=64’.

Alas, as Z572 found out, packages that use Gnulib are typically built
that way, but other packages, such as ‘nss’ and ‘bash’, are often built
with a 32-bit ‘time_t’.  Our modified libfaketime fails badly in these
cases.

The libfaketime limitations are discussed in
<https://github.com/wolfcw/libfaketime/issues/418>.

OTOH, datefudge explicitly provides replacements for both the 32-bit and
64-bit variants of the relevant libc symbols on 32-bit platforms.  It
seems to work fine with 32-bit time_t programs (like ‘bash’) and 64-bit
time_t programs (like ‘date’ from Coreutils):

--8<---------------cut here---------------start------------->8---
$ ./pre-inst-env guix shell -s i686-linux datefudge bash coreutils -- datefudge 2023-01-01 bash -c true
$ ./pre-inst-env guix shell -s i686-linux datefudge bash coreutils -- datefudge 2023-01-01 date
Sun Jan  1 00:00:00 CET 2023
--8<---------------cut here---------------end--------------->8---

So the easiest short-term solution seems to be using datefudge to run
the ‘nss’ tests on 32-bit platforms, as Chris already suggested before
(patch below; it’s being built right now, I’ll see tomorrow if it
worked…).

Longer-term, as discussed with Z572, we should set up a branch where
we’d ensure “everything” uses 64-bit ‘time_t’ on 32-bit platforms
(that’s beyond the scope of this issue though).

Ludo’.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 1654 bytes --]

diff --git a/gnu/packages/nss.scm b/gnu/packages/nss.scm
index 49276817ae..da3847fcb1 100644
--- a/gnu/packages/nss.scm
+++ b/gnu/packages/nss.scm
@@ -40,7 +40,8 @@ (define-module (gnu packages nss)
   #:use-module (gnu packages crates-io)
   #:use-module (gnu packages compression)
   #:use-module (gnu packages perl)
-  #:use-module (gnu packages sqlite))
+  #:use-module (gnu packages sqlite)
+  #:use-module (gnu packages time))
 
 (define-public nspr
   (package
@@ -215,7 +216,8 @@ (define-public nss
                     ;; leading to test failures:
                     ;; <https://bugzilla.mozilla.org/show_bug.cgi?id=609734>.  To
                     ;; work around that, set the time to roughly the release date.
-                    (invoke "faketime" "2024-01-23" "./nss/tests/all.sh"))
+                    (invoke #$(if (target-64bit?) "faketime" "datefudge")
+                            "2024-01-23" "./nss/tests/all.sh"))
                   (format #t "test suite not run~%"))))
           (replace 'install
             (lambda* (#:key outputs #:allow-other-keys)
@@ -240,7 +242,9 @@ (define-public nss
                 (copy-recursively (string-append obj "/lib") lib)))))))
     (inputs (list sqlite zlib))
     (propagated-inputs (list nspr))               ;required by nss.pc.
-    (native-inputs (list perl libfaketime which)) ;for tests
+    (native-inputs (list perl
+                         (if (target-64bit?) libfaketime datefudge)
+                         which)) ;for tests
 
     ;; The NSS test suite takes around 48 hours on Loongson 3A (MIPS) when
     ;; another build is happening concurrently on the same machine.

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2024-07-26  9:15 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-21 22:21 bug#72239: libfaketime (still) broken on i686-linux Ludovic Courtès
2024-07-22  7:08 ` Ludovic Courtès
2024-07-22 12:55   ` Christopher Baines
2024-07-23 10:41     ` Ludovic Courtès
2024-07-23 11:40       ` Christopher Baines
2024-07-23 21:11         ` Ludovic Courtès
2024-07-26  9:13           ` Ludovic Courtès

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.