[Bug time/24004] New: tzset, localtime, etc. slow if TZ is unset, and mishandle TZ="" vs TZ=":"

eggert at cs dot ucla.edu sourceware-bugzilla@sourceware.org
Tue Dec 18 22:03:00 GMT 2018


https://sourceware.org/bugzilla/show_bug.cgi?id=24004

            Bug ID: 24004
           Summary: tzset, localtime, etc. slow if TZ is unset, and
                    mishandle TZ="" vs TZ=":"
           Product: glibc
           Version: 2.28
            Status: NEW
          Severity: normal
          Priority: P2
         Component: time
          Assignee: unassigned at sourceware dot org
          Reporter: eggert at cs dot ucla.edu
  Target Milestone: ---

Created attachment 11472
  --> https://sourceware.org/bugzilla/attachment.cgi?id=11472&action=edit
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.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the Glibc-bugs mailing list