The __tzset_parse_tz fails to parse the valid string formats as described by POSIX. This was introduced with the following commit. http://sourceware.org/git/?p=glibc.git;a=commit;h=82780cbee540bc7e61de6eb165d0f3ec7aa9e549 $ cat tzset-minimal.c #include <time.h> extern char* tzname[]; main() { tzset(); printf ("std tzname is %s\n", *tzname[0]?tzname[0]:"NULL"); return 0; } $ TZ="A?BC0" ./tzset-minimal std tzname is NULL
POSIX does not specify the interpretation of this time zone string.
http://www.opengroup.org/onlinepubs/007908775/xbd/envvar.html
The tzset() page points to the page for environment variables. http://www.opengroup.org/onlinepubs/007908775/xsh/tzset.html -> http://www.opengroup.org/onlinepubs/007908775/xbd/envvar.html
(In reply to comment #3) > The tzset() page points to the page for environment variables. > > http://www.opengroup.org/onlinepubs/007908775/xsh/tzset.html -> > > http://www.opengroup.org/onlinepubs/007908775/xbd/envvar.html And? The format is specified as std offset dst offset, rule where std is either <[a-zA-Z0-9+-]{3,TZNAME_MAX}> or [a-zA-Z]{3,TZNAME_MAX} Nowhere a question mark is allowed. That form is just invalid and the implementation is correct to reject it.
You are right. POSIX doesn't say it can be any character. It clearly says it should be alphanumeric in < > or alphabetic. It is the SUSv3 which says it can be any character. [ snip ] Where: std and dst Indicates no less than three, nor more than {TZNAME_MAX}, bytes that are the designation for the standard ( std ) or the alternative ( dst - such as Daylight Savings Time) timezone. Only std is required; if dst is missing, then the alternative time does not apply in this locale. Upper- and lower-case letters are explicitly allowed. Any graphic characters except a leading colon (:) or digits, the comma (,), the minus (-), the plus (+), and the null character are permitted to appear in these fields, but their meaning is unspecified.