From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Ken Brown Newsgroups: gmane.emacs.devel Subject: Configure test for whether localtime caches TZ Date: Sat, 30 Oct 2010 14:29:00 -0400 Message-ID: <4CCC63EC.7050604@cornell.edu> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1288463362 3184 80.91.229.12 (30 Oct 2010 18:29:22 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sat, 30 Oct 2010 18:29:22 +0000 (UTC) To: Emacs Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Oct 30 20:29:18 2010 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1PCGB3-0002Tj-T1 for ged-emacs-devel@m.gmane.org; Sat, 30 Oct 2010 20:29:18 +0200 Original-Received: from localhost ([127.0.0.1]:42094 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PCGB3-0004dW-BP for ged-emacs-devel@m.gmane.org; Sat, 30 Oct 2010 14:29:17 -0400 Original-Received: from [140.186.70.92] (port=50797 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PCGAx-0004ce-M5 for emacs-devel@gnu.org; Sat, 30 Oct 2010 14:29:12 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PCGAw-0004Rs-3h for emacs-devel@gnu.org; Sat, 30 Oct 2010 14:29:11 -0400 Original-Received: from granite1.mail.cornell.edu ([128.253.83.141]:49844 helo=authusersmtp.mail.cornell.edu) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PCGAw-0004RE-0Y for emacs-devel@gnu.org; Sat, 30 Oct 2010 14:29:10 -0400 Original-Received: from [192.168.1.5] (cpe-67-249-196-94.twcny.res.rr.com [67.249.196.94]) (authenticated bits=0) by authusersmtp.mail.cornell.edu (8.14.4/8.12.10) with ESMTP id o9UISwKK003559 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT) for ; Sat, 30 Oct 2010 14:28:59 -0400 (EDT) User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.11) Gecko/20101013 Thunderbird/3.1.5 X-detected-operating-system: by eggs.gnu.org: Solaris 9 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:132195 Archived-At: 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 -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);