From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Paul Eggert Newsgroups: gmane.emacs.bugs Subject: bug#19874: 25.0.50; encode-time not working as expected Date: Wed, 25 Feb 2015 09:41:45 -0800 Organization: UCLA Computer Science Department Message-ID: <54EE0959.5080901@cs.ucla.edu> References: <86vbj35m3n.fsf@chateau.d.if> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------090106080907080609060307" X-Trace: ger.gmane.org 1424886143 28415 80.91.229.3 (25 Feb 2015 17:42:23 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 25 Feb 2015 17:42:23 +0000 (UTC) Cc: 19874@debbugs.gnu.org To: Ashish SHUKLA Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Feb 25 18:42:12 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 1YQfyN-0007GD-JF for geb-bug-gnu-emacs@m.gmane.org; Wed, 25 Feb 2015 18:42:11 +0100 Original-Received: from localhost ([::1]:55604 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YQfyM-0000My-RX for geb-bug-gnu-emacs@m.gmane.org; Wed, 25 Feb 2015 12:42:10 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:48318) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YQfyJ-0000Jw-0z for bug-gnu-emacs@gnu.org; Wed, 25 Feb 2015 12:42:07 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YQfyE-0001mG-QK for bug-gnu-emacs@gnu.org; Wed, 25 Feb 2015 12:42:06 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:54431) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YQfyE-0001mC-Np for bug-gnu-emacs@gnu.org; Wed, 25 Feb 2015 12:42:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1YQfyE-0007gt-8s for bug-gnu-emacs@gnu.org; Wed, 25 Feb 2015 12:42:02 -0500 X-Loop: help-debbugs@gnu.org In-Reply-To: <86vbj35m3n.fsf@chateau.d.if> Resent-From: Paul Eggert Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 25 Feb 2015 17:42:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 19874 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 19874-submit@debbugs.gnu.org id=B19874.142488611929554 (code B ref 19874); Wed, 25 Feb 2015 17:42:02 +0000 Original-Received: (at 19874) by debbugs.gnu.org; 25 Feb 2015 17:41:59 +0000 Original-Received: from localhost ([127.0.0.1]:58029 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YQfyA-0007gc-Nt for submit@debbugs.gnu.org; Wed, 25 Feb 2015 12:41:59 -0500 Original-Received: from smtp.cs.ucla.edu ([131.179.128.62]:60338) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YQfy8-0007gL-3E for 19874@debbugs.gnu.org; Wed, 25 Feb 2015 12:41:56 -0500 Original-Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp.cs.ucla.edu (Postfix) with ESMTP id D8F14A6000D; Wed, 25 Feb 2015 09:41:49 -0800 (PST) X-Virus-Scanned: amavisd-new at smtp.cs.ucla.edu Original-Received: from smtp.cs.ucla.edu ([127.0.0.1]) by localhost (smtp.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id IHYL4PHtDqGY; Wed, 25 Feb 2015 09:41:49 -0800 (PST) Original-Received: from [192.168.1.9] (pool-100-32-155-148.lsanca.fios.verizon.net [100.32.155.148]) by smtp.cs.ucla.edu (Postfix) with ESMTPSA id 88903A6000C; Wed, 25 Feb 2015 09:41:49 -0800 (PST) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 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:99813 Archived-At: This is a multi-part message in MIME format. --------------090106080907080609060307 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Thanks for the bug report. My guess is that there's an incompatibility with FreeBSD 10.1 amd64 mktime. I can't reproduce the problem on FreeBSD 9.1 x86. Please try the attached patch, just for debugging, and then run the following one-line shell command: src/emacs -Q -batch -eval '(progn (setenv "TZ" "Asia/Kolkata") (print (encode-time 44 42 6 15 2 2015 0 nil 0)))' What output do you get? Here's what I get on Fedora 21 x86-64, which seems correct: oldtz=Asia/Kolkata tz=XXX-0:00:00 oldTZ=Asia/Kolkata TZ=XXX-0:00:00 2015-02-15 06:42:44 -1 -> 2015-02-15 06:42:44 0 = 1423982564 Assuming you get different output, can you debug Emacs with GDB to send us more details about what's going wrong? If not, can you give me access to a FreeBSD 10.1 amd64 machine like yours? --------------090106080907080609060307 Content-Type: text/x-patch; name="debug-encode-time.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="debug-encode-time.patch" diff --git a/src/editfns.c b/src/editfns.c index dbcb316..fca95d5 100644 --- a/src/editfns.c +++ b/src/editfns.c @@ -1423,10 +1423,28 @@ mktime_z (timezone_t tz, struct tm *tm) oldtz = strcpy (oldtzcopy, oldtz); } block_input (); + char const *oldTZ = getenv ("TZ"); + if (oldTZ) + oldTZ = xstrdup (oldTZ); set_time_zone_rule (tz); + char const *TZ = getenv ("TZ"); + fprintf (stderr, + ("oldtz=%s tz=%s oldTZ=%s TZ=%s " + "%.4d-%.2d-%.2d %.2d:%.2d:%.2d %d -> "), + oldtz ? oldtz : "(null)", + tz ? tz : "(null)", + oldTZ ? oldTZ : "(null)", + TZ ? TZ : "(null)", + tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, + tm->tm_hour, tm->tm_min, tm->tm_sec, + tm->tm_isdst); time_t t = mktime (tm); set_time_zone_rule (oldtz); unblock_input (); + fprintf (stderr, "%.4d-%.2d-%.2d %.2d:%.2d:%.2d %d = %ld", + tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, + tm->tm_hour, tm->tm_min, tm->tm_sec, + tm->tm_isdst, (long) t); SAFE_FREE (); return t; } --------------090106080907080609060307--