From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#21020: 24.4; `display-time-world' tampers with TZ Date: Mon, 27 Jul 2015 20:29:43 +0300 Message-ID: <83zj2hy0e0.fsf@gnu.org> References: <55B487B4.7060709@cs.ucla.edu> <83vbd7yny9.fsf@gnu.org> <55B51362.2010301@cs.ucla.edu> <83lhe2zuu9.fsf@gnu.org> <55B51F1A.2000100@cs.ucla.edu> <83io96zsnj.fsf@gnu.org> <55B5399C.8040202@cs.ucla.edu> <83fv49zsuq.fsf@gnu.org> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1438018238 20947 80.91.229.3 (27 Jul 2015 17:30:38 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 27 Jul 2015 17:30:38 +0000 (UTC) Cc: 21020@debbugs.gnu.org, wgg2@member.fsf.org To: eggert@cs.ucla.edu Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Jul 27 19:30:26 2015 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1ZJmEA-0005yy-RQ for geb-bug-gnu-emacs@m.gmane.org; Mon, 27 Jul 2015 19:30:15 +0200 Original-Received: from localhost ([::1]:54753 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZJmEA-0005tG-4N for geb-bug-gnu-emacs@m.gmane.org; Mon, 27 Jul 2015 13:30:14 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:48171) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZJmE6-0005rx-29 for bug-gnu-emacs@gnu.org; Mon, 27 Jul 2015 13:30:11 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZJmE3-0008HF-9H for bug-gnu-emacs@gnu.org; Mon, 27 Jul 2015 13:30:10 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:59029) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZJmE3-0008GE-6g for bug-gnu-emacs@gnu.org; Mon, 27 Jul 2015 13:30:07 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1ZJmE2-0006y6-CB for bug-gnu-emacs@gnu.org; Mon, 27 Jul 2015 13:30:06 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 27 Jul 2015 17:30:06 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 21020 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 21020-submit@debbugs.gnu.org id=B21020.143801819826753 (code B ref 21020); Mon, 27 Jul 2015 17:30:06 +0000 Original-Received: (at 21020) by debbugs.gnu.org; 27 Jul 2015 17:29:58 +0000 Original-Received: from localhost ([127.0.0.1]:60475 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZJmDt-0006xQ-Ug for submit@debbugs.gnu.org; Mon, 27 Jul 2015 13:29:58 -0400 Original-Received: from mtaout24.012.net.il ([80.179.55.180]:39634) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZJmDr-0006xH-O8 for 21020@debbugs.gnu.org; Mon, 27 Jul 2015 13:29:56 -0400 Original-Received: from conversion-daemon.mtaout24.012.net.il by mtaout24.012.net.il (HyperSendmail v2007.08) id <0NS500100PFBLH00@mtaout24.012.net.il> for 21020@debbugs.gnu.org; Mon, 27 Jul 2015 20:21:26 +0300 (IDT) Original-Received: from HOME-C4E4A596F7 ([87.69.4.28]) by mtaout24.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0NS500GH7PJQFI90@mtaout24.012.net.il>; Mon, 27 Jul 2015 20:21:26 +0300 (IDT) In-reply-to: <83fv49zsuq.fsf@gnu.org> X-012-Sender: halo1@inter.net.il X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:105173 Archived-At: > Date: Mon, 27 Jul 2015 15:29:33 +0300 > From: Eli Zaretskii > Cc: 21020@debbugs.gnu.org, wgg2@member.fsf.org > > After the above commit, Emacs builds and generally seems to work, but > crashes inside icalendar tests. Seems like something with heap > corruption. I'm looking into that now. The reason seems to be these assignments in time_rz.c: static bool revert_tz (timezone_t tz) { if (tz == local_tz) return true; else { int saved_errno = errno; bool ok = change_env (tz); if (!ok) saved_errno = errno; #if HAVE_TZNAME if (!ok) tzname_address = NULL; if (tzname_address) { char *old_value = *tzname_address; *tzname_address = tzname_value; <<<<<<<<<<<<<<<<<<<<<<< tzname_value = old_value; } #endif tzfree (tz); errno = saved_errno; return ok; } } static void restore_tzname (void) { #if HAVE_TZNAME if (tzname_address) { *tzname_address = tzname_value; <<<<<<<<<<<<<<<<<<<<<< tzname_address = NULL; } #endif } If I ifdef away the 2 marked lines, the test suite runs flawlessly to completion. tzname_address is the address of one of the members of the tzname[] array, which holds pointers into the bowels of libc. I don't know why overwriting them with our values causes such trouble, but even if this is supposed to work, it makes me nervous. I'm not even sure I understand completely why this trick is needed (can you explain?). In any case, can we please do this in some less intrusive way, e.g., by copying the TZ names to our private storage? Thanks.