bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#21020: 24.4; `display-time-world' tampers with TZ


From: Paul Eggert
Subject: bug#21020: 24.4; `display-time-world' tampers with TZ
Date: Mon, 27 Jul 2015 18:09:37 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.8.0

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.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]