Allow searching `$TZDIR` for timezone data

glibc supports the environment variable as additional search path. We
now add this to the config validation to allow runtimes to search that
path as well.

Signed-off-by: Sascha Grunert <sgrunert@redhat.com>
This commit is contained in:
Sascha Grunert 2023-12-20 09:38:17 +01:00
parent abf5ac33dd
commit 3364dc90a2
1 changed files with 7 additions and 0 deletions

View File

@ -67,6 +67,13 @@ func (c *ContainersConfig) validateTZ() error {
"/etc/zoneinfo",
}
// Allow using TZDIR per:
// https://sourceware.org/git/?p=glibc.git;a=blob;f=time/tzfile.c;h=8a923d0cccc927a106dc3e3c641be310893bab4e;hb=HEAD#l149
tzdir := os.Getenv("TZDIR")
if tzdir != "" {
lookupPaths = append(lookupPaths, tzdir)
}
for _, paths := range lookupPaths {
zonePath := filepath.Join(paths, c.TZ)
if _, err := os.Stat(zonePath); err == nil {