Bug 24004 - tzset, localtime, etc. slow if TZ is unset, and mishandle TZ="" vs TZ=":"
Summary: tzset, localtime, etc. slow if TZ is unset, and mishandle TZ="" vs TZ=":"
Status: NEW
Alias: None
Product: glibc
Classification: Unclassified
Component: time (show other bugs)
Version: 2.28
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-12-18 22:03 UTC by eggert
Modified: 2023-11-10 10:51 UTC (History)
8 users (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:
fweimer: security-


Attachments
tzset patch to fix /etc/localtime polling issue (1.76 KB, patch)
2018-12-18 22:03 UTC, eggert
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description eggert 2018-12-18 22:03:51 UTC
Created attachment 11472 [details]
tzset patch to fix /etc/localtime polling issue

While looking at Bug#21060 I noticed two easily fixable problems with tzset.

First it does not treat TZ=":" like TZ="" even though the documentation says they should be equivalent. This is because TZ=":" is always UT without leap seconds, whereas TZ="" is usually (but not always) UT without leap seconds; the latter differs if the "Universal" TZif file specifies leap seconds. Other systems are more consistent about treating TZ="" as avoiding leap seconds, so glibc should too.

Second, and more important, if TZ is unset then tzset, localtime, etc. always stat /etc/localtime (or whatever TZDEFAULT happens to expand to). They should cache an unset TZ's data just as well as the cache a set TZ's data.

ma.jiang noticed the second problem independently <https://www.sourceware.org/ml/libc-alpha/2018-12/msg00617.html>.

Proposed patch attached.
Comment 1 Ahmad Samir 2023-03-12 19:13:40 UTC
Hello; any news about this one?