GNU bug report logs - #21020
24.4; `display-time-world' tampers with TZ

Previous Next

Package: emacs;

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 #54 received at 21020 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Paul Eggert <eggert <at> cs.ucla.edu>
Cc: 21020 <at> debbugs.gnu.org, wgg2 <at> member.fsf.org
Subject: Re: 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 <at> cs.ucla.edu>
> CC: 21020 <at> debbugs.gnu.org, wgg2 <at> 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.




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.