[PATCH] tzset_internal: do not reset old_tz if no change from default value

Paul Eggert eggert@cs.ucla.edu
Fri Feb 28 00:26:25 GMT 2025


On 2/27/25 13:53, Dominique Martinet wrote:
> - the `TZ` env var could point to a symlink just the same

tzset assumes that although /etc/localtime might change, 
/usr/share/zoneinfo/* does not change.

Hence if the system operator changes the system's wall clock time zone 
by changing /etc/localtime, processes where TZ is unset will see this 
change the next time they invoke tzset (directly or indirectly).

However, if the system operator updates the files in /usr/share/zoneinfo 
because a new TZDB version came out with new rules for (say) 
America/Asuncion, newly invoked processes will see the update after the 
next tzset, but an already-running process where TZ="America/Asuncion" 
won't see the new rules merely by invoking tzset; it will need to change 
TZ to some other value, invoke tzset, change back, and invoke tzset again.

Read glibc/time/tzset.c's tzset_internal function to see more details 
than what I've just said. This behavior isn't documented anywhere, and 
it'd be unwise to rely on it in future glibc versions.

> - even if it is a symlink

It does not matter whether the files are symbolic or hard links. What 
matters are their contents when you open and read them.


More information about the Libc-alpha mailing list