-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Description
The zoneinfo database typically uses symlinks to connect locations with identical content but different names. This works implicitly with Time::Location.load
.
There is a distinction though between current aliases and legacy aliases which are only kept for backwards compatibility.
Some packages no longer keep the latter as symlinks on the file system. For example, the tzdata
package in debian removed backward compatibility aliases in version 2023d-1 (https://salsa.debian.org/glibc-team/tzdata/-/blob/6bce3482cda5148d16a4d013a2cf3bfa18de7b74/debian/NEWS#L23-35).
As a result, these symlinks no longer exist and Crystal's time zone loader cannot find them.
For example, the symlink for America/Buenos_Aires
is missing in debian testing (trixie) with only the tzdata
package installed, while it exists in debian 12:
debian:stable$ ls -ld /usr/share/zoneinfo/America/Buenos_Aires
lrwxrwxrwx 1 root root 22 Mar 26 20:52 /usr/share/zoneinfo/America/Buenos_Aires -> Argentina/Buenos_Aires
debian:testing$ ls -ld /usr/share/zoneinfo/America/Buenos_Aires
ls: cannot access '/usr/share/zoneinfo/America/Buenos_Aires': No such file or directory
We use this name in specs and examples. Apparently it's a legacy name and the actual name is America/Argentina/Buenos_Aires
which honestly feels like a quirk, but that's what we got 🤷 We should probably change the references to the current name instead.
It's possible to regain these symlinks by installing the tzdata-legacy
package. But requiring that does not seem like a reasonable solution.
We should make Crystal's time zone loader aware of backwards compatibility aliases even when symlinks do not exist.
Backwards compatibility aliases are statically available in https://data.iana.org/time-zones/tzdb/backward
They should rarely change (in contrast to the actual TZDB data) so it might be acceptable to bake this list in.
If the tzdata source file is available (for example /usr/share/zoneinfo/tzdata.zi
included in many tzdata installations), we could parse links from there.