From c60d2ffe2e149a5227540a3abf08f14d31141483 Mon Sep 17 00:00:00 2001 From: Vincenzo Mantova <1962985+xworld21@users.noreply.github.com> Date: Mon, 8 May 2023 12:41:41 +0100 Subject: [PATCH] texlive.combine: call faketime from within fmtutil Calling 'faketime fmtutil' fails on some non-NixOS systems, due to fmtutil calling system, and implicitly /bin/sh, which may be incompatible with faketime's LD_PRELOAD (e.g. using a different glibc). This change moves faketime within fmtutil so that LD_PRELOAD is applied only to the final binary. --- pkgs/tools/typesetting/tex/texlive/combine.nix | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pkgs/tools/typesetting/tex/texlive/combine.nix b/pkgs/tools/typesetting/tex/texlive/combine.nix index 645f9042bd5b..95c297650483 100644 --- a/pkgs/tools/typesetting/tex/texlive/combine.nix +++ b/pkgs/tools/typesetting/tex/texlive/combine.nix @@ -248,7 +248,11 @@ in (buildEnv { # libfaketime fixes non-determinism related to timestamps ignoring FORCE_SOURCE_DATE # we cannot fix further randomness caused by luatex; for further details, see # https://salsa.debian.org/live-team/live-build/-/blob/master/examples/hooks/reproducible/2006-reproducible-texlive-binaries-fmt-files.hook.chroot#L52 - FORCE_SOURCE_DATE=1 TZ= faketime -f '@1980-01-01 00:00:00 x0.001' fmtutil --sys --all | grep '^fmtutil' # too verbose + # note that calling faketime and fmtutil is fragile (faketime uses LD_PRELOAD, fmtutil calls /bin/sh, causing potential glibc issues on non-NixOS) + # so we patch fmtutil to use faketime, rather than calling faketime fmtutil + substitute "$out/bin/fmtutil" fmtutil \ + --replace 'my $cmdline = "$eng -ini ' 'my $cmdline = "faketime -f '"'"'\@1980-01-01 00:00:00 x0.001'"'"' $eng -ini ' + FORCE_SOURCE_DATE=1 TZ= perl fmtutil --sys --all | grep '^fmtutil' # too verbose #texlinks "$out/bin" && wrapBin # do we need to regenerate format links? # Disable unavailable map files