Bug 1077377

Summary: tzset(3) incorrectly sets the 'int daylight' variable.
Product: [Fedora] Fedora Reporter: pjp <pj.pandit>
Component: glibcAssignee: Carlos O'Donell <codonell>
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 22CC: codonell, fweimer, jakub, law, mnewsome, pfrankli
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-02-04 10:53:18 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Reproducer for tzset(3) issue.
none
localtime(3) test program none

Description pjp 2014-03-17 20:26:08 UTC
Created attachment 875675 [details]
Reproducer for tzset(3) issue.

Description of problem: (also discussed in BZ#1076801 [1])

tzset(3) manual says

  "... In a  System-V like environment, it will also set the variables
   timezone (seconds West of UTC) and daylight (to 0 if this timezone
   does not have any  daylight saving  time  rules,  or  to nonzero if
   there is a time during the year when daylight saving time applies)."

But it incorrectly sets daylight=1 even in time-zones which do NOT follow DST at all, ever. Ex. India Standard Time(IST)

Version-Release number of selected component (if applicable): glibc-2.18-12.fc20.x86_64


How reproducible: always


Steps to Reproduce:
1. download the attached reproducer
2. cc -xc -o t t.c
3. ./t

Actual results:
===
$ ls /etc/localtime 
lrwxrwxrwx. 1 /etc/localtime -> ../usr/share/zoneinfo/Asia/Kolkata
$
$ date '+%Z %z'
IST +0530
$
$ ./t 
daylight: 0
tz[0]: IST, tz[1]: IST, daylight: 1
$
$
$ ls -l /etc/localtime 
lrwxrwxrwx. 1 /etc/localtime -> /usr/share/zoneinfo/Asia/Singapore
$
$ date '+%Z %z'
SGT +0800
$
$ ./t
daylight: 0
tz[0]: SGT, tz[1]: MALST, daylight: 1
$
===

Expected results:
===
$ ./t
daylight: 0
tz[0]: IST, tz[1]: IST, daylight: 0
$
$ ./t
daylight: 0
tz[0]: SGT, tz[1]: SGT, daylight: 0
===


Additional info:
[1] -> https://bugzilla.redhat.com/show_bug.cgi?id=1076801
[2] -> http://www.timeanddate.com/time/dst/2014.html

Comment 1 pjp 2014-03-17 20:30:07 UTC
Created attachment 875676 [details]
localtime(3) test program

The localtime(3) call works as expected and correctly sets the 'tm_isdst' field value.

Comment 2 Jaroslav Reznik 2015-03-03 15:35:54 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 22 development cycle.
Changing version to '22'.

More information and reason for this action is here:
https://fedoraproject.org/wiki/Fedora_Program_Management/HouseKeeping/Fedora22

Comment 3 Florian Weimer 2016-02-04 10:53:18 UTC
See the explanation in bug 1290533 comment 3.  This is not a bug.

Comment 4 Florian Weimer 2016-02-05 15:12:38 UTC
*** Bug 1076794 has been marked as a duplicate of this bug. ***