unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Paul Eggert <eggert@cs.ucla.edu>
To: Eli Zaretskii <eliz@gnu.org>
Cc: schwab@linux-m68k.org, fabrice.popineau@gmail.com, emacs-devel@gnu.org
Subject: Re: Setting TZ in set_time_zone_rule
Date: Fri, 30 Nov 2012 12:47:14 -0800	[thread overview]
Message-ID: <50B91B52.5060105@cs.ucla.edu> (raw)
In-Reply-To: <83sj7qudmw.fsf@gnu.org>

On 11/30/12 10:52, Eli Zaretskii wrote:

>> set_time_zone_rule (0) needs to unset TZ.
> 
> Do we ever call it that way?

Yes, if TZ is unset in the environment.

>>>>> Also, is unsetenv("TZ") the same as putenv("TZ=") ?
>>> Yes.
>>
>> Doesn't the former unset TZ, and the latter set TZ to the empty string?
> 
> The implementation I saw unset TZ in both cases.

Which implementation is that?  It does not conform to POSIX.
At any rate, we can't rely on that behavior.

I just thought of another problem: setenv has a memory leak,
by design: it leaks the memory holding the previous value of
the environment variable.  So I guess we should use putenv
after all.  We can use the gnulib putenv module for hosts that
lack putenv.  We'll also need unsetenv (but not setenv).

I'll look into drafting a patch along these lines this weekend.
The code is a bit of a mess in this area, unfortunately.
Among other things, the current uses of setenv and putenv
assume that they always succeed, but they can fail just as
malloc can fail, due to lack of memory.



      reply	other threads:[~2012-11-30 20:47 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-28 18:12 Setting TZ in set_time_zone_rule Eli Zaretskii
2012-11-28 20:21 ` Paul Eggert
2012-11-28 21:24   ` Andreas Schwab
2012-11-29  1:21     ` Paul Eggert
2012-11-29  3:44       ` Eli Zaretskii
2012-11-29 21:39         ` Paul Eggert
2012-11-30  9:08           ` Eli Zaretskii
2012-11-30  9:26             ` Fabrice Popineau
2012-11-30 10:02               ` Eli Zaretskii
2012-11-30 18:22                 ` Paul Eggert
2012-11-30 18:52                   ` Eli Zaretskii
2012-11-30 20:47                     ` Paul Eggert [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=50B91B52.5060105@cs.ucla.edu \
    --to=eggert@cs.ucla.edu \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=fabrice.popineau@gmail.com \
    --cc=schwab@linux-m68k.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).