Bug 168862 - [tzcode] [patch] tzname set incorrectly
Summary: [tzcode] [patch] tzname set incorrectly
Status: Open
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 9.0-STABLE
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-bugs (Nobody)
Depends on:
Reported: 2012-06-08 16:40 UTC by Martin Nowak
Modified: 2018-05-20 23:51 UTC (History)
1 user (show)

See Also:

file.diff (468 bytes, patch)
2012-06-08 16:40 UTC, Martin Nowak
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Nowak 2012-06-08 16:40:14 UTC
tzname is not set to the latest zone name


Fix: Patch attached with submission follows:
How-To-Repeat: #include <time.h>
#include <stdio.h>
#include <stdlib.h>

int main()
    setenv("TZ", "America/Los_Angeles", 1);
    // prints PPT instead of PDT
    printf("%s\n", tzname[1]);
    return 0;
Comment 1 Eitan Adler freebsd_committer freebsd_triage 2012-07-09 01:22:35 UTC
Responsible Changed
From-To: freebsd-bugs->eadler

I'll take it.
Comment 2 Eitan Adler freebsd_committer freebsd_triage 2012-09-02 18:06:42 UTC
Responsible Changed
From-To: eadler->freebsd-bugs

I won't be looking at this PR for a while and I need to clear some out 
of my queue
Comment 3 Jonathan M Davis 2015-04-27 00:34:36 UTC
This bug still exists in FreeBSD 10.1, and it's been almost three years since this was reported, which seems like a long time for this to be sitting around - particularly considering that a patch has been attached to it.

And it affects a _lot_ more time zones than just "America/Los_Angeles". Comparing what tzname says to what's in the TZ files themselves (using D's std.datetime time zone code to read the TZ files), I'm seeing 133 time zones that have their tzname[0] wrong, and 249 that have their tzname[1] wrong.

Curiously, the date command seems to print out the correct time zone names (at least in "America/Los_Angeles"), so I guess that date doesn't use tzname, and that may be why more folks haven't complained, but this needs to get fixed.

What would it take for the patch to be reviewed and merged in? I'm not set up to develop on FreeBSD, so I don't know how to test the changes (and I'd really prefer to not have to figure out how to set that up), but from what I can tell from looking at the code, it looks like the change in the patch is correct.
Comment 4 Eitan Adler freebsd_committer freebsd_triage 2018-05-20 23:51:54 UTC
For bugs matching the following conditions:
- Status == In Progress
- Assignee == "bugs@FreeBSD.org"
- Last Modified Year <= 2017

- Set Status to "Open"