Bug 29951 - daylight variable not set correctly if last DST change coincides with offset change
Summary: daylight variable not set correctly if last DST change coincides with offset ...
Status: RESOLVED FIXED
Alias: None
Product: glibc
Classification: Unclassified
Component: time (show other bugs)
Version: 2.37
: P2 normal
Target Milestone: 2.37
Assignee: Florian Weimer
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-01-02 09:51 UTC by Florian Weimer
Modified: 2023-01-05 17:43 UTC (History)
1 user (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Florian Weimer 2023-01-02 09:51:37 UTC
The daylight variable is supposed to be set to 1 if DST is every in use for the current time zone. But __tzfile_read does this:

  __daylight = rule_stdoff != rule_dstoff;

This check can fail to set __daylight to 1 if the DST and non-DST offsets happen to be the same.

The current tz data for Africa/Tripoli exposes this bug.
Comment 1 Florian Weimer 2023-01-02 11:19:23 UTC
Patch posted:

[PATCH] time: Set daylight to 1 for matching DST/offset change (bug 29951)
<https://sourceware.org/pipermail/libc-alpha/2023-January/144434.html>
Comment 2 Florian Weimer 2023-01-05 17:43:38 UTC
Fixed via:

commit 35141f304e319109c322f797ae71c0b9420ccb05
Author: Florian Weimer <fweimer@redhat.com>
Date:   Thu Jan 5 18:21:25 2023 +0100

    time: Set daylight to 1 for matching DST/offset change (bug 29951)
    
    The daylight variable is supposed to be set to 1 if DST is ever in
    use for the current time zone.  But __tzfile_read used to do this:
    
      __daylight = rule_stdoff != rule_dstoff;
    
    This check can fail to set __daylight to 1 if the DST and non-DST
    offsets happen to be the same.