GNU bug report logs -
#21020
24.4; `display-time-world' tampers with TZ
Previous Next
Reported by: William G. Gardella <wgg2 <at> member.fsf.org>
Date: Thu, 9 Jul 2015 19:41:02 UTC
Severity: normal
Tags: patch
Found in version 24.4
Done: Paul Eggert <eggert <at> cs.ucla.edu>
Bug is archived. No further changes may be made.
Full log
Message #51 received at 21020 <at> debbugs.gnu.org (full text, mbox):
Eli Zaretskii wrote:
> I'm not even sure I
> understand completely why this trick is needed (can you explain?).
On many platforms, calling 'tzset' (either directly, or indirectly via localtime
etc.) invalidates tzname[0] and tzname[1]. For example:
time_t t = 0;
char *p = tzname[0];
localtime (&t);
puts (p ? p : "(null)");
Here 'puts' has undefined behavior if tzname[0] has been updated and its old
value (equal to P) is no longer a valid pointer.
lib/time_rz.c attempted to work around this problem by replacing tzname[0] and
tzname[1] with pointers to more-stable copies. Apparently this doesn't work
under MinGW.
> can we please do this in some less intrusive way, e.g., by
> copying the TZ names to our private storage?
OK, I did that in master commit 2856b1dd6f0ff5164eb5a54ddfadb9963f9e9237.
This bug report was last modified 9 years and 299 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.