Skip to content

tzdata: Use release timestamp for "now" tests - #582265

Closed
ARitz-Cracker wants to merge 1 commit into
NixOS:stagingfrom
ARitz-Cracker:patch-1
Closed

ARitz-Cracker wants to merge 1 commit into
NixOS:stagingfrom
ARitz-Cracker:patch-1

Conversation

@ARitz-Cracker

@ARitz-Cracker ARitz-Cracker commented Nov 2, 2026 •

Copy link
Copy Markdown

Closes #582038

tzdata fails to build on or after 2026-11-01 due to the consequences of regions changing their timezones.

The time man himself, Paul Eggert, notes the following.

Release 2026f could not have contained the attached patch, as that would have caused "make now.ck" to fail back when 2026f was released, as there would have been missing entries. It's unfortunate that this sort of "make check" failure can occur due only to time passing. Perhaps there's a way to have the Makefile use the release timestamp if you've made no changes since the release, and today's timestamp otherwise.

If timezone-related tests relative to "now" are expected to fail as regions change their timezones, then we perhaps should use the release timestamp in order to make the tests actually deterministic. This fix, (suggested by Claude Opus 5.5) uses the source timestamp as a means toward that end.

Things done

@ARitz-Cracker ARitz-Cracker mentioned this pull request Nov 2, 2026
2 of 13 tasks
@nixpkgs-ci nixpkgs-ci Bot added the 12.first-time contribution This PR is the author's first one; please be gentle! label Nov 2, 2026
@nixpkgs-ci
nixpkgs-ci Bot requested review from ajs124 and fpletz November 2, 2026 14:59
@nixpkgs-ci nixpkgs-ci Bot added 10.rebuild-linux: 501+ This PR causes many rebuilds on Linux and should normally target the staging branches. 10.rebuild-darwin: 501+ This PR causes many rebuilds on Darwin and should normally target the staging branches. 10.rebuild-darwin-stdenv This PR causes stdenv to rebuild on Darwin and must target a staging branch. 10.rebuild-darwin: 5001+ This PR causes many rebuilds on Darwin and must target the staging branches. 10.rebuild-linux: 5001+ This PR causes many rebuilds on Linux and must target the staging branches. 10.rebuild-nixos-tests This PR causes rebuilds for all NixOS tests and should normally target the staging branches. labels Nov 2, 2026
@trofi

trofi commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

Does it work for you? Fails for me just as it does without the change:

$ nix build github:NixOS/nixpkgs/pull/582265/merge#tzdata -L
...
tzdata> zones America/Phoenix and America/Vancouver identical from now on
tzdata> zones America/Mexico_City and America/Edmonton identical from now on
tzdata> zones America/Jamaica and America/Winnipeg identical from now on
tzdata> make: *** [Makefile:1014: now.ck] Error 1

@trofi

trofi commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

In contrast the following seems to work for me:

--- a/pkgs/by-name/tz/tzdata/package.nix
+++ b/pkgs/by-name/tz/tzdata/package.nix
@@ -117,0 +118,11 @@ stdenv.mkDerivation (finalAttrs: {
+  preCheck = ''
+    # Releases 2026e and 2026f fail if built on or after 2026-11-01
+    # Mitigate this and potential future issues by testing with the release timestamp
+    # See: https://lists.iana.org/hyperkitty/list/[email protected]/message/WCIAEEDCPA5HT3LLJK6YQ6FH7ND5ORIK/
+    release_timestamp=$(awk '/^Release /{print $4, $5, $6; exit}' NEWS)
+    release_time_t=$(date -d"$release_timestamp" +%s)
+    checkFlagsArray+=(
+      "CHECK_NOW_TIMESTAMP=$release_time_t"
+    )
+  '';
+

@ARitz-Cracker

Copy link
Copy Markdown
Author

Does it work for you? Fails for me just as it does without the change:

$ nix build github:NixOS/nixpkgs/pull/582265/merge#tzdata -L
...
tzdata> zones America/Phoenix and America/Vancouver identical from now on
tzdata> zones America/Mexico_City and America/Edmonton identical from now on
tzdata> zones America/Jamaica and America/Winnipeg identical from now on
tzdata> make: *** [Makefile:1014: now.ck] Error 1

My bad, some weird caching thing must have happened with me before, re-running the build as you have sets SOURCE_DATE_EPOCH to the time where the build started. Though perhaps instead of invoking awk, we could grab the mtime of NEWS or version.

@ARitz-Cracker

Copy link
Copy Markdown
Author

Anyway, I'm gonna close this since this specific solution isn't viable in all cases

uninsane added a commit to uninsane/nixpkgs that referenced this pull request Nov 3, 2026
fixes `nix-build -A tzdata`

sourced from
<NixOS#582265 (comment)>

Co-authored-by: Sergei Trofimovich <[email protected]>
@uninsane

uninsane commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

In contrast the following seems to work for me:

--- a/pkgs/by-name/tz/tzdata/package.nix
+++ b/pkgs/by-name/tz/tzdata/package.nix
@@ -117,0 +118,11 @@ stdenv.mkDerivation (finalAttrs: {
+  preCheck = ''
+    # Releases 2026e and 2026f fail if built on or after 2026-11-01
+    # Mitigate this and potential future issues by testing with the release timestamp
+    # See: https://lists.iana.org/hyperkitty/list/[email protected]/message/WCIAEEDCPA5HT3LLJK6YQ6FH7ND5ORIK/
+    release_timestamp=$(awk '/^Release /{print $4, $5, $6; exit}' NEWS)
+    release_time_t=$(date -d"$release_timestamp" +%s)
+    checkFlagsArray+=(
+      "CHECK_NOW_TIMESTAMP=$release_time_t"
+    )
+  '';
+

@trofi i applied this and created a PR for it here. included you in the Co-authored-by line, but let me know if you prefer otherwise.

qcwallace pushed a commit to Qumulo/nixpkgs that referenced this pull request Nov 3, 2026
fixes `nix-build -A tzdata`

sourced from
<NixOS#582265 (comment)>

Co-authored-by: Sergei Trofimovich <[email protected]>
al3xtjames pushed a commit to al3xtjames/nixpkgs that referenced this pull request Nov 4, 2026
fixes `nix-build -A tzdata`

sourced from
<NixOS#582265 (comment)>

Co-authored-by: Sergei Trofimovich <[email protected]>
al3xtjames pushed a commit to al3xtjames/nixpkgs that referenced this pull request Nov 5, 2026
fixes `nix-build -A tzdata`

sourced from
<NixOS#582265 (comment)>

Co-authored-by: Sergei Trofimovich <[email protected]>
al3xtjames pushed a commit to al3xtjames/nixpkgs that referenced this pull request Nov 6, 2026
fixes `nix-build -A tzdata`

sourced from
<NixOS#582265 (comment)>

Co-authored-by: Sergei Trofimovich <[email protected]>
al3xtjames pushed a commit to al3xtjames/nixpkgs that referenced this pull request Nov 7, 2026
fixes `nix-build -A tzdata`

sourced from
<NixOS#582265 (comment)>

Co-authored-by: Sergei Trofimovich <[email protected]>
wegank pushed a commit to loongson-community/nixpkgs that referenced this pull request Nov 7, 2026
fixes `nix-build -A tzdata`

sourced from
<NixOS#582265 (comment)>

Co-authored-by: Sergei Trofimovich <[email protected]>
(cherry picked from commit e3e93a8)
tm-drtina pushed a commit to awakesecurity/nixpkgs that referenced this pull request Nov 9, 2026
fixes `nix-build -A tzdata`

sourced from
<NixOS#582265 (comment)>

Co-authored-by: Sergei Trofimovich <[email protected]>
al3xtjames pushed a commit to al3xtjames/nixpkgs that referenced this pull request Nov 13, 2026
fixes `nix-build -A tzdata`

sourced from
<NixOS#582265 (comment)>

Co-authored-by: Sergei Trofimovich <[email protected]>
al3xtjames pushed a commit to al3xtjames/nixpkgs that referenced this pull request Nov 13, 2026
fixes `nix-build -A tzdata`

sourced from
<NixOS#582265 (comment)>

Co-authored-by: Sergei Trofimovich <[email protected]>
al3xtjames pushed a commit to al3xtjames/nixpkgs that referenced this pull request Nov 14, 2026
fixes `nix-build -A tzdata`

sourced from
<NixOS#582265 (comment)>

Co-authored-by: Sergei Trofimovich <[email protected]>
al3xtjames pushed a commit to al3xtjames/nixpkgs that referenced this pull request Nov 15, 2026
fixes `nix-build -A tzdata`

sourced from
<NixOS#582265 (comment)>

Co-authored-by: Sergei Trofimovich <[email protected]>
al3xtjames pushed a commit to al3xtjames/nixpkgs that referenced this pull request Nov 15, 2026
fixes `nix-build -A tzdata`

sourced from
<NixOS#582265 (comment)>

Co-authored-by: Sergei Trofimovich <[email protected]>
al3xtjames pushed a commit to al3xtjames/nixpkgs that referenced this pull request Nov 18, 2026
fixes `nix-build -A tzdata`

sourced from
<NixOS#582265 (comment)>

Co-authored-by: Sergei Trofimovich <[email protected]>
al3xtjames pushed a commit to al3xtjames/nixpkgs that referenced this pull request Nov 22, 2026
fixes `nix-build -A tzdata`

sourced from
<NixOS#582265 (comment)>

Co-authored-by: Sergei Trofimovich <[email protected]>
al3xtjames pushed a commit to al3xtjames/nixpkgs that referenced this pull request Nov 23, 2026
fixes `nix-build -A tzdata`

sourced from
<NixOS#582265 (comment)>

Co-authored-by: Sergei Trofimovich <[email protected]>
moeleak pushed a commit to moeleak/nixpkgs that referenced this pull request Dec 1, 2026
fixes `nix-build -A tzdata`

sourced from
<NixOS#582265 (comment)>

Co-authored-by: Sergei Trofimovich <[email protected]>
(cherry picked from commit e3e93a8)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

10.rebuild-darwin: 501+ This PR causes many rebuilds on Darwin and should normally target the staging branches. 10.rebuild-darwin: 5001+ This PR causes many rebuilds on Darwin and must target the staging branches. 10.rebuild-darwin-stdenv This PR causes stdenv to rebuild on Darwin and must target a staging branch. 10.rebuild-linux: 501+ This PR causes many rebuilds on Linux and should normally target the staging branches. 10.rebuild-linux: 5001+ This PR causes many rebuilds on Linux and must target the staging branches. 10.rebuild-nixos-tests This PR causes rebuilds for all NixOS tests and should normally target the staging branches. 12.first-time contribution This PR is the author's first one; please be gentle!

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants