Bug 168862

Summary: [tzcode] tzname set incorrectly
Product: Base System Reporter: Martin Nowak <dawg>
Component: binAssignee: freebsd-bugs (Nobody) <bugs>
Status: Closed Overcome By Events    
Severity: Affects Only Me CC: Alexander88207, delphij, freebsd.bugs
Priority: Normal    
Version: 9.0-STABLE   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
file.diff none

Description Martin Nowak 2012-06-08 16:40:14 UTC
tzname is not set to the latest zone name

http://www.freebsd.org/cgi/cvsweb.cgi/src/contrib/tzcode/stdtime/localtime.c.diff?r1=1.1;r2=1.2

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);
    tzset();
    // 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

Do
- Set Status to "Open"
Comment 5 Graham Perrin freebsd_committer freebsd_triage 2022-10-17 12:40:27 UTC
Keyword: 

    patch
or  patch-ready

– in lieu of summary line prefix: 

    [patch]

* bulk change for the keyword
* summary lines may be edited manually (not in bulk). 

Keyword descriptions and search interface: 

    <https://bugs.freebsd.org/bugzilla/describekeywords.cgi>
Comment 6 Xin LI freebsd_committer freebsd_triage 2025-01-28 22:17:45 UTC
This was fixed by 93cc70bf9ca755bdfc43cf34cd762549fd9cba51 (stable/13) and a24d752d3e77a28c877a5319face8d00aa1b558c (stable/14).