Bug 1077377 - tzset(3) incorrectly sets the 'int daylight' variable.
Summary: tzset(3) incorrectly sets the 'int daylight' variable.
Alias: None
Product: Fedora
Classification: Fedora
Component: glibc
Version: 22
Hardware: All
OS: Linux
Target Milestone: ---
Assignee: Carlos O'Donell
QA Contact: Fedora Extras Quality Assurance
: 1076794 (view as bug list)
Depends On:
TreeView+ depends on / blocked
Reported: 2014-03-17 20:26 UTC by pjp
Modified: 2016-02-05 15:12 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2016-02-04 10:53:18 UTC
Type: Bug

Attachments (Terms of Use)
Reproducer for tzset(3) issue. (257 bytes, text/plain)
2014-03-17 20:26 UTC, pjp
no flags Details
localtime(3) test program (334 bytes, text/plain)
2014-03-17 20:30 UTC, pjp
no flags Details

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:

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. ***

Note You need to log in before you can comment on or make changes to this bug.