* Configure test for whether localtime caches TZ
@ 2010-10-30 18:29 Ken Brown
2010-10-31 18:30 ` Glenn Morris
0 siblings, 1 reply; 3+ messages in thread
From: Ken Brown @ 2010-10-30 18:29 UTC (permalink / raw)
To: Emacs
The configure test for whether localtime caches TZ directly modifies the
environment and so (according to POSIX) might produce unreliable
results. Wouldn't it be better to use unsetenv, as in the following
patch (against the emacs-23 branch):
=== modified file 'configure.in'
--- configure.in 2010-05-10 00:37:59 +0000
+++ configure.in 2010-10-30 18:07:03 +0000
@@ -2441,14 +2441,6 @@
AC_CACHE_VAL(emacs_cv_localtime_cache,
[if test x$ac_cv_func_tzset = xyes; then
AC_TRY_RUN([#include <time.h>
-extern char **environ;
-unset_TZ ()
-{
- char **from, **to;
- for (to = from = environ; (*to = *from); from++)
- if (! (to[0][0] == 'T' && to[0][1] == 'Z' && to[0][2] == '='))
- to++;
-}
char TZ_GMT0[] = "TZ=GMT0";
char TZ_PST8[] = "TZ=PST8";
main()
@@ -2458,13 +2450,13 @@
if (putenv (TZ_GMT0) != 0)
exit (1);
hour_GMT0 = localtime (&now)->tm_hour;
- unset_TZ ();
+ unsetenv("TZ");
hour_unset = localtime (&now)->tm_hour;
if (putenv (TZ_PST8) != 0)
exit (1);
if (localtime (&now)->tm_hour == hour_GMT0)
exit (1);
- unset_TZ ();
+ unsetenv("TZ");
if (localtime (&now)->tm_hour != hour_unset)
exit (1);
exit (0);
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Configure test for whether localtime caches TZ
2010-10-30 18:29 Configure test for whether localtime caches TZ Ken Brown
@ 2010-10-31 18:30 ` Glenn Morris
2010-10-31 23:25 ` Ken Brown
0 siblings, 1 reply; 3+ messages in thread
From: Glenn Morris @ 2010-10-31 18:30 UTC (permalink / raw)
To: Ken Brown; +Cc: Emacs
Ken Brown wrote:
> The configure test for whether localtime caches TZ directly modifies
> the environment and so (according to POSIX) might produce unreliable
> results. Wouldn't it be better to use unsetenv, as in the following
> patch (against the emacs-23 branch):
Seems better, assuming it is portable. Not worth putting in emacs-23
IMO though, since the current code has been there for decades with no
(?) reported problems.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Configure test for whether localtime caches TZ
2010-10-31 18:30 ` Glenn Morris
@ 2010-10-31 23:25 ` Ken Brown
0 siblings, 0 replies; 3+ messages in thread
From: Ken Brown @ 2010-10-31 23:25 UTC (permalink / raw)
To: Glenn Morris; +Cc: Emacs
On 10/31/2010 2:30 PM, Glenn Morris wrote:
> Ken Brown wrote:
>
>> The configure test for whether localtime caches TZ directly modifies
>> the environment and so (according to POSIX) might produce unreliable
>> results. Wouldn't it be better to use unsetenv, as in the following
>> patch (against the emacs-23 branch):
>
> Seems better, assuming it is portable. Not worth putting in emacs-23
> IMO though, since the current code has been there for decades with no
> (?) reported problems.
It should be more portable than the existing code. I've checked it into
the trunk.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-10-31 23:25 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-30 18:29 Configure test for whether localtime caches TZ Ken Brown
2010-10-31 18:30 ` Glenn Morris
2010-10-31 23:25 ` Ken Brown
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).