]> git.ipfire.org Git - thirdparty/systemd.git/commit
basic: validate timezones in get_timezones()
authorNick Rosbrook <enr0n@ubuntu.com>
Thu, 18 Sep 2025 13:16:02 +0000 (09:16 -0400)
committerLennart Poettering <lennart@poettering.net>
Thu, 18 Sep 2025 19:33:24 +0000 (21:33 +0200)
commit9fe168a92c87d9b2def3a18d54b0b62c04c4aee0
treecf9cf62455e82b5edb0ef54f6428bcba44516ac8
parent818bd1dfa1e4ac222b1fc5d238807e49fd1d7939
basic: validate timezones in get_timezones()

Depending on the packaging of tzdata, /usr/share/zoneinfo/tzdata.zi may
reference zones or links that are not actually present on the system.
E.g. on Debian and Ubuntu, there is a tzdata-legacy package that
contains "legacy" zones and links, but they are still referenced in
/usr/share/zoneinfo/tzdata.zi shipped by the main tzdata package.

Right now, get_timezoes() does not validate timezones when building the
list, which makes the following possible:

 $ timedatectl list-timezones | grep "US/Alaska"
 US/Alaska

 $ timedatectl set-timezone US/Alaska
 Failed to set time zone: Invalid or not installed time zone 'US/Alaska'

which feels buggy. Hence, simply validate timezones in get_timezones()
to avoid listing timezones that are not installed.
src/basic/time-util.c