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#23600: 25.1.50; encode-time returns wrong result Date: Wed, 1 Jun 2016 01:19:50 -0700 Organization: UCLA Computer Science Department Message-ID: <574E9AA6.1070606@cs.ucla.edu> References: <86oa7xaglt.wl--xmue@d1.dion.ne.jp> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------000507040808030703020904" X-Trace: ger.gmane.org 1464769298 15295 80.91.229.3 (1 Jun 2016 08:21:38 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 1 Jun 2016 08:21:38 +0000 (UTC) Cc: 23600@debbugs.gnu.org To: Kazuhiro Ito Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Jun 01 10:21:27 2016 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 1b81P4-0003ZL-AH for geb-bug-gnu-emacs@m.gmane.org; Wed, 01 Jun 2016 10:21:26 +0200 Original-Received: from localhost ([::1]:40786 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b81P3-00088q-4z for geb-bug-gnu-emacs@m.gmane.org; Wed, 01 Jun 2016 04:21:25 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:39148) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b81Ok-0007zv-2x for bug-gnu-emacs@gnu.org; Wed, 01 Jun 2016 04:21:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b81Og-0007tQ-0Z for bug-gnu-emacs@gnu.org; Wed, 01 Jun 2016 04:21:05 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:36715) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b81Of-0007tM-TL for bug-gnu-emacs@gnu.org; Wed, 01 Jun 2016 04:21:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1b81Of-0000Eo-QK for bug-gnu-emacs@gnu.org; Wed, 01 Jun 2016 04:21:01 -0400 X-Loop: help-debbugs@gnu.org In-Reply-To: <86oa7xaglt.wl--xmue@d1.dion.ne.jp> Resent-From: Paul Eggert Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 01 Jun 2016 08:21:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 23600 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 23600-submit@debbugs.gnu.org id=B23600.1464769201809 (code B ref 23600); Wed, 01 Jun 2016 08:21:01 +0000 Original-Received: (at 23600) by debbugs.gnu.org; 1 Jun 2016 08:20:01 +0000 Original-Received: from localhost ([127.0.0.1]:49052 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1b81Nh-0000Cv-9c for submit@debbugs.gnu.org; Wed, 01 Jun 2016 04:20:01 -0400 Original-Received: from zimbra.cs.ucla.edu ([131.179.128.68]:34377) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1b81Nf-0000CZ-0p for 23600@debbugs.gnu.org; Wed, 01 Jun 2016 04:19:59 -0400 Original-Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id F34251613B6; Wed, 1 Jun 2016 01:19:51 -0700 (PDT) Original-Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id n5WDt6e6tGRh; Wed, 1 Jun 2016 01:19:51 -0700 (PDT) Original-Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 24B0B1613FF; Wed, 1 Jun 2016 01:19:51 -0700 (PDT) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Original-Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id JAOl9IBqsmB6; Wed, 1 Jun 2016 01:19:51 -0700 (PDT) Original-Received: from [192.168.1.9] (unknown [100.32.155.148]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id EF20E1613B6; Wed, 1 Jun 2016 01:19:50 -0700 (PDT) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.8.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.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" Xref: news.gmane.org gmane.emacs.bugs:118921 Archived-At: This is a multi-part message in MIME format. --------------000507040808030703020904 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable Thanks for the bug report. This appears to be due to an incompatibility b= etween=20 MS-Windows and POSIX that I didn't know about. Please try the attached pa= tch. I=20 have not tested or installed this (I don't use MS-Windows). --------------000507040808030703020904 Content-Type: text/x-diff; name="0001-Port-angle-bracket-TZ-settings-to-MS-Windows.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="0001-Port-angle-bracket-TZ-settings-to-MS-Windows.patch" =46rom fef3119fc136889673a1a032ee0a5a47584a03fe Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Wed, 1 Jun 2016 01:09:42 -0700 Subject: [PATCH] Port angle-bracket TZ settings to MS-Windows * doc/lispref/os.texi (Time Zone Rules): Document MS-Windows lack of support for numeric time zone abbreviations. * src/w32.c (sys_putenv): Convert angle-bracket TZ syntax to MS-compatible syntax if possible, and to "ZZZ" otherwise. Problem reported by Kazuhiro Ito (Bug#23600). --- doc/lispref/os.texi | 3 ++- src/w32.c | 29 +++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/doc/lispref/os.texi b/doc/lispref/os.texi index becb691..38dde26 100644 --- a/doc/lispref/os.texi +++ b/doc/lispref/os.texi @@ -1327,7 +1327,8 @@ Time Zone Rules a string, the conversion uses the time zone rule equivalent to setting @env{TZ} to that string. If it is an integer @var{offset}, the conversion uses a fixed time zone with the given offset and a numeric -abbreviation. If it is a list (@var{offset} @var{abbr}), where +abbreviation on POSIX-compatible platforms and an unspecified abbreviati= on +on MS-Windows. If it is a list (@var{offset} @var{abbr}), where @var{offset} is an integer number of seconds east of Universal Time and @var{abbr} is a string, the conversion uses a fixed time zone with the given offset and abbreviation. diff --git a/src/w32.c b/src/w32.c index 442ce79..71a38b9 100644 --- a/src/w32.c +++ b/src/w32.c @@ -2505,6 +2505,35 @@ sys_putenv (char *str) return unsetenv (str); } =20 + if (strncmp (str, "TZ=3D<", 4) =3D=3D 0) + { + /* MS-Windows does not support POSIX.1-2001 angle-bracket TZ + abbreviation syntax. Convert to POSIX.1-1988 syntax if possible, + and to the undocumented placeholder "ZZZ" otherwise. */ + bool supported_abbr =3D true; + for (char *p =3D str + 4; *p; p++) + { + if (('0' <=3D *p && *p <=3D '9') || *p =3D=3D '-' || *p =3D=3D '+') + supported_abbr =3D false; + else if (*p =3D=3D '>') + { + ptrdiff_t abbrlen; + if (supported_abbr) + { + abbrlen =3D p - (str + 4); + memmove (str + 3, str + 4, abbrlen); + } + else + { + abbrlen =3D 3; + memset (str + 3, 'Z', abbrlen); + } + memmove (str + 3 + abbrlen, p + 1, strlen (p)); + break; + } + } + } + return _putenv (str); } =20 --=20 2.7.4 --------------000507040808030703020904--