tree-wide: stop assigning colon prefixed timezone to $TZ

glibc (and also musl, though we do not officially support it yet)
silently ignores colon prefix in $TZ. Let's always not prefix the
timezone.

tzset(3) states:
> A nonempty value of TZ can be one of two formats, either of which can
> be preceded by a colon which is ignored.

Addresses https://github.com/systemd/systemd/pull/38876#discussion_r2384347594.
This commit is contained in:
Yu Watanabe
2025-09-28 11:14:00 +09:00
parent 7d6f1d695c
commit 8431368668
4 changed files with 7 additions and 18 deletions
+1 -4
View File
@@ -1436,10 +1436,7 @@ int calendar_spec_next_usec(const CalendarSpec *spec, usec_t usec, usec_t *ret_n
SAVE_TIMEZONE;
/* tzset(3) says $TZ should be prefixed with ":" if we reference timezone files */
const char *colon_tz = strjoina(":", spec->timezone);
r = RET_NERRNO(setenv("TZ", colon_tz, 1));
r = RET_NERRNO(setenv("TZ", spec->timezone, /* overwrite = */ true));
if (r < 0)
return r;