From c6c2299d94a49d9833d96b6804fce3f6d1cfe04b Mon Sep 17 00:00:00 2001 From: Grimmauld Date: Mon, 9 Jun 2025 15:37:45 +0200 Subject: [PATCH] jq: disable failing time conversion test on 32 bit jq upstream has a test right on 32 bit epoch end [1]. On i686-linux, this test is executed because it is a native build. However, the test will fail on 32 bit. The *good* solution is to build jq with 64 bit time representation. That might break with dynamic linking though, so instead we just disable this test. Note: this is a bit of a hack! [1] https://github.com/jqlang/jq/blob/859a8073ee8a21f2133154eea7c2bd5e0d60837f/tests/optional.test#L17 --- .../disable-end-of-epoch-conversion-test.patch | 16 ++++++++++++++++ pkgs/by-name/jq/jq/package.nix | 9 +++++++++ 2 files changed, 25 insertions(+) create mode 100644 pkgs/by-name/jq/jq/disable-end-of-epoch-conversion-test.patch diff --git a/pkgs/by-name/jq/jq/disable-end-of-epoch-conversion-test.patch b/pkgs/by-name/jq/jq/disable-end-of-epoch-conversion-test.patch new file mode 100644 index 000000000000..570d443db12f --- /dev/null +++ b/pkgs/by-name/jq/jq/disable-end-of-epoch-conversion-test.patch @@ -0,0 +1,16 @@ +diff --git a/tests/optional.test b/tests/optional.test +index 2623731..85bc9e9 100644 +--- a/tests/optional.test ++++ b/tests/optional.test +@@ -12,11 +12,6 @@ last(range(365 * 67)|("1970-03-01T01:02:03Z"|strptime("%Y-%m-%dT%H:%M:%SZ")|mkti + null + [2037,1,11,1,2,3,3,41] + +-# Regression test for #3276 +-fromdate +-"2038-01-19T03:14:08Z" +-2147483648 +- + # %e is not available on mingw/WIN32 + strftime("%A, %B %e, %Y") + 1435677542.822351 diff --git a/pkgs/by-name/jq/jq/package.nix b/pkgs/by-name/jq/jq/package.nix index 074e24725fc6..5d3a7c3aa975 100644 --- a/pkgs/by-name/jq/jq/package.nix +++ b/pkgs/by-name/jq/jq/package.nix @@ -30,6 +30,15 @@ stdenv.mkDerivation (finalAttrs: { "out" ]; + # tortured syntax to avoid rebuilds + # needed because epoch conversion test here is right at the end of 32 bit integer space + # See also: https://github.com/jqlang/jq/blob/859a8073ee8a21f2133154eea7c2bd5e0d60837f/tests/optional.test#L15-L18 + # "-D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64" would be preferrable, but breaks with dynamic linking, + # unless done globally in stdenv for all of 32 bit. + ${if stdenv.hostPlatform.is32bit then "patches" else null} = [ + ./disable-end-of-epoch-conversion-test.patch + ]; + # https://github.com/jqlang/jq/issues/2871 postPatch = lib.optionalString stdenv.hostPlatform.isFreeBSD '' substituteInPlace Makefile.am --replace-fail "tests/mantest" "" --replace-fail "tests/optionaltest" ""