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: Eli Zaretskii
Subject: bug#21020: 24.4; `display-time-world' tampers with TZ
Date: Tue, 28 Jul 2015 13:37:38 +0300

> Date: Mon, 27 Jul 2015 18:09:37 -0700
> From: Paul Eggert <eggert@cs.ucla.edu>
> CC: 21020@debbugs.gnu.org, wgg2@member.fsf.org
> 
> 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.

I see, thanks for explaining.

>  > 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.

Thanks, this solves the problem.





reply via email to

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