[Bug 241978] tzname not always set right

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Fri Nov 15 06:19:40 UTC 2019


            Bug ID: 241978
           Summary: tzname not always set right
           Product: Base System
           Version: 12.1-RELEASE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: standards
          Assignee: standards at FreeBSD.org
          Reporter: deepbluemistake at gmail.com

tzname doesn't always get set.  Assuming it's meant to be POSIX-compliant (not
necessarily XSI/SUS here, but POSIX) then the following behavior is buggy:
Doing the following:

export TZ=CAT0
cat > daytime.c <<EOF
#include <stdio.h>
#include <time.h>

int main(void)
        printf("tzname[0]: %s\n", tzname[0]);
        printf("tzname[1]: %s\n", tzname[1]);
        printf("daylight: %d\n", daylight);
        printf("timezone: %ld\n", timezone);
cc daytime.c

The following is the output on my system:

tzname[0]: EST

nota bene: the second one isn't null/blank/empty, it's three spaces.
This is incorrect, as CAT0 is a valid value of TZ.  If we set it to CAT0DOG0
instead, the output changes dramatically:

tzname[0]: CAT
tzname[1]: DOG

This is the expected output for when TZ is CAT0DOG0.
Back to TZ just being CAT0, a friend using GNU/Linux was able to show me the
output there:

tzname[0]: CAT
tzname[1]: CAT

If I read POSIX correctly, GNU's implementation and output are correct here. 
This is the output I expect.

I found OpenBSD's output was also buggy, in a different way:


(similar note: neither of those are null/empty, they're three spaces)

I already sent OpenBSD a bug report.


You are receiving this mail because:
You are the assignee for the bug.

More information about the freebsd-standards mailing list