https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114645

            Bug ID: 114645
           Summary: std::chrono::current_zone ignores $TZ on Linux
           Product: gcc
           Version: 13.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hristo at venev dot name
  Target Milestone: ---

On all platforms, glibc first checks $TZ, and only defaults to `/etc/localtime`
if it isn't set. Empty $TZ means UTC. One starting `:` is removed.

glibc interprets $TZ as a path, which is resolved relative to
${TZDIR:-default_tzdir}.

(if __libc_enable_secure is set, some checks are made to $TZ to prevent reading
of arbitrary files. In particular, it must not contain "../", and if absolute,
must either be "/etc/localtime" or must start with the default $TZDIR)

Some more details:

https://sourceware.org/git/?p=glibc.git;a=blob;f=time/tzset.c;hb=ae7468a7b0bcf22e9cd5fcae42bb9e4f65de83ee#l365

https://sourceware.org/git/?p=glibc.git;a=blob;f=time/tzfile.c;hb=ae7468a7b0bcf22e9cd5fcae42bb9e4f65de83ee#l105

Reply via email to