From 4268e25679f320d9434d0bdec0d2d49719c09c5c Mon Sep 17 00:00:00 2001 From: emilylange Date: Sat, 4 Apr 2026 05:07:59 +0200 Subject: [PATCH] nixos/tests/timezone: extend to test systemd `/etc/timezone` regression This should help to catch the regression described in 2fb95a568c107c7074f2d4ed25e63b6deaa496d2 if it ever does end up resurfacing. Please see that commit for more details on this. The tl;dr is: At the very least systemd and icu::TimeZone both make assumptions about how the /etc/localtime symlink they read should look like. In one of our systemd patches, we broke this for both itself and icu::TimeZone. And while we could extend our systemd patch, we cannot as easily patch icu and we don't know who else makes similar assumptions. --- nixos/tests/timezone.nix | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/nixos/tests/timezone.nix b/nixos/tests/timezone.nix index b5d2f6779338..938c6bed9534 100644 --- a/nixos/tests/timezone.nix +++ b/nixos/tests/timezone.nix @@ -44,6 +44,18 @@ print(date_result) assert date_result == "1970-01-01 09:00:00\n", "Timezone was not adjusted" + # Stop systemd-timedated.service to clear /etc/localtime read cache + node_nulltz.systemctl("stop systemd-timedated.service") + timedatectl_result = node_nulltz.succeed("timedatectl status") + print(timedatectl_result) + assert "Asia/Tokyo" in timedatectl_result, "'timedatectl status' output is missing 'Asia/Tokyo'" + + with subtest("imperative - Ensure /etc/localtime symlink includes '/zoneinfo/' like icu expects"): + # https://github.com/unicode-org/icu/blob/release-78.3/icu4c/source/common/putil.cpp#L686-L695 + readlink_result = node_nulltz.succeed("readlink --no-newline /etc/localtime") + print(readlink_result) + assert "/zoneinfo/" in readlink_result, f"/etc/localtime symlink is missing '/zoneinfo/': {readlink_result}" + with subtest("imperative - Ensure timezone adjustment persists across reboot"): # Adjustment should persist across a reboot node_nulltz.shutdown()