Hi, I've had complaints from FreeBSD users and downstream vendors about the change in 2025a which replaced "UTC" with "-00" when we fail to load a time zone. It turns out quite a few people relied on the old default as a faster way of setting the time zone to UTC, and I can't say I blame them. The attached patch changes tzset_unlocked() slightly so that UNSPEC is only used if TZ was set or zoneinit() returned an error other than ENOENT, so the behavior TZ is unset and TZDEFAULT does not exist is unchanged but we still get an error indication if TZ is set to something we don't understand, or TZDEFAULT exists but can't be read, or TZDEFAULT is readable but not a valid TZif file.
DES -- Dag-Erling Smørgrav - [email protected]
>From 85342832bae78a9371f0f9a134e4b85faf4d6a9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dag-Erling=20Sm=C3=B8rgrav?= <[email protected]> Date: Mon, 22 Sep 2025 17:59:00 +0200 Subject: [PATCH 1/1] Use -00 only for invalid time zones. If TZ is unset and TZDEFAULT does not exist, fall back to "UTC" as before, reserving "-00" for when either TZ or the content of TZDEFAULT is invalid. --- localtime.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/localtime.c b/localtime.c index f534383b..d1250b00 100644 --- a/localtime.c +++ b/localtime.c @@ -1484,9 +1484,11 @@ tzset_unlocked(void) lclptr = sp = malloc(sizeof *lclptr); # endif if (sp) { - if (zoneinit(sp, name, TZLOAD_FROMENV | TZLOAD_TZSTRING) != 0) { + int err = zoneinit(sp, name, TZLOAD_FROMENV | TZLOAD_TZSTRING); + if (err != 0) { zoneinit(sp, "", 0); - strcpy(sp->chars, UNSPEC); + if (name != NULL || err != ENOENT) + strcpy(sp->chars, UNSPEC); } if (0 < lcl) strcpy(lcl_TZname, name); -- 2.51.0
