From 11bd9aaa81fef5d2a9e96b82745617f931cbca66 Mon Sep 17 00:00:00 2001 From: Sascha Grunert Date: Wed, 20 Dec 2023 09:38:17 +0100 Subject: [PATCH] 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 --- pkg/config/config_local.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pkg/config/config_local.go b/pkg/config/config_local.go index dae3ea0d9..bcee683d6 100644 --- a/pkg/config/config_local.go +++ b/pkg/config/config_local.go @@ -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 {