From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Paul Eggert Newsgroups: gmane.emacs.bugs Subject: bug#27736: OSX 10.6.8: Building from master branch fails. Date: Tue, 27 Mar 2018 14:19:22 -0700 Organization: UCLA Computer Science Department Message-ID: <46d25462-4eb0-0bd0-f5ab-2b28bae98ee6@cs.ucla.edu> References: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------7B05822E539B8B3D19976AED" X-Trace: blaine.gmane.org 1522185498 25410 195.159.176.226 (27 Mar 2018 21:18:18 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 27 Mar 2018 21:18:18 +0000 (UTC) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 Cc: Keith David Bershatsky , 27736@debbugs.gnu.org, Noam Postavsky To: "Charles A. Roelli" Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Mar 27 23:18:13 2018 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1f0vyt-0006Uw-RB for geb-bug-gnu-emacs@m.gmane.org; Tue, 27 Mar 2018 23:18:12 +0200 Original-Received: from localhost ([::1]:36155 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f0w0x-0007bt-3r for geb-bug-gnu-emacs@m.gmane.org; Tue, 27 Mar 2018 17:20:19 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:41505) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f0w0k-0007XZ-G7 for bug-gnu-emacs@gnu.org; Tue, 27 Mar 2018 17:20:09 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f0w0g-0004tK-9x for bug-gnu-emacs@gnu.org; Tue, 27 Mar 2018 17:20:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:48425) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1f0w0g-0004tC-2O for bug-gnu-emacs@gnu.org; Tue, 27 Mar 2018 17:20:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1f0w0f-0004dK-TP for bug-gnu-emacs@gnu.org; Tue, 27 Mar 2018 17:20:01 -0400 X-Loop: help-debbugs@gnu.org In-Reply-To: Resent-From: Paul Eggert Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 27 Mar 2018 21:20:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 27736 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 27736-submit@debbugs.gnu.org id=B27736.152218557217768 (code B ref 27736); Tue, 27 Mar 2018 21:20:01 +0000 Original-Received: (at 27736) by debbugs.gnu.org; 27 Mar 2018 21:19:32 +0000 Original-Received: from localhost ([127.0.0.1]:56322 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1f0w0C-0004cW-C0 for submit@debbugs.gnu.org; Tue, 27 Mar 2018 17:19:32 -0400 Original-Received: from zimbra.cs.ucla.edu ([131.179.128.68]:44054) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1f0w09-0004cI-L9 for 27736@debbugs.gnu.org; Tue, 27 Mar 2018 17:19:30 -0400 Original-Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 2297F160E32; Tue, 27 Mar 2018 14:19:24 -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 HpzABto-E9MY; Tue, 27 Mar 2018 14:19:22 -0700 (PDT) Original-Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id BCF131611D3; Tue, 27 Mar 2018 14:19:22 -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 9_ND-V0xuaEo; Tue, 27 Mar 2018 14:19:22 -0700 (PDT) Original-Received: from Penguin.CS.UCLA.EDU (Penguin.CS.UCLA.EDU [131.179.64.200]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id 988A8160E32; Tue, 27 Mar 2018 14:19:22 -0700 (PDT) Content-Language: en-US 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:144661 Archived-At: This is a multi-part message in MIME format. --------------7B05822E539B8B3D19976AED Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit > > (<= m -1034058203136) > > (<= m -1034058203135)) Unfortunately these numbers don't fit into a 30-bit integer and so they run afoul of a portability issue, namely, that files byte-compiled on a 64-bit Emacs should run on a 32-bit Emacs and vice versa. I noticed this problem when preparing a patch to catch this sort of issue. To fix this particular instance of the problem, I attempted to migrate the localtime workaround into editfns.c (so that the fix is more-general, and is not limited to org-clock), by installing the attached patches into master. Please give them a try, since I don't have easy access to Mac OS X. I'm still a bit fuzzy on exactly which timestamps cause Mac OS X localtime to go belly-up (is it timezone dependent?), so quite possibly the magic numbers in these patches need to be adjusted a bit so that the code will work in any timezone from TZ=AAA-24:59:59 to TZ=ZZZ24:59:59; please let me know. --------------7B05822E539B8B3D19976AED Content-Type: text/x-patch; name="0001-Update-from-Gnulib.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="0001-Update-from-Gnulib.patch" >From 72fad885b68617db85901a8e810211b557a31f99 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 27 Mar 2018 13:30:50 -0700 Subject: [PATCH 1/2] Update from Gnulib This incorporates: 2018-03-26 time_rz: work around Mac OS X 10.6 infloop 2018-03-20 euidaccess: Port to native Windows. * lib/euidaccess.c, lib/time_rz.c, m4/time_rz.m4: Copy from Gnulib. --- lib/euidaccess.c | 11 ++++++++--- lib/time_rz.c | 15 +++++++++++++++ m4/time_rz.m4 | 32 ++++++++++++++++++++++++++++++++ 3 files changed, 55 insertions(+), 3 deletions(-) diff --git a/lib/euidaccess.c b/lib/euidaccess.c index aee693571c..4f512f5af5 100644 --- a/lib/euidaccess.c +++ b/lib/euidaccess.c @@ -29,8 +29,11 @@ #include #include #include - -#include "root-uid.h" +#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ +# include +#else +# include "root-uid.h" +#endif #if HAVE_LIBGEN_H # include @@ -84,7 +87,9 @@ euidaccess (const char *file, int mode) return accessx (file, mode, ACC_SELF); #elif HAVE_EACCESS /* FreeBSD */ return eaccess (file, mode); -#else /* Mac OS X, NetBSD, OpenBSD, HP-UX, Solaris, Cygwin, mingw, BeOS */ +#elif (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ /* mingw */ + return _access (file, mode); +#else /* Mac OS X, NetBSD, OpenBSD, HP-UX, Solaris, Cygwin, BeOS */ uid_t uid = getuid (); gid_t gid = getgid (); diff --git a/lib/time_rz.c b/lib/time_rz.c index c1eca888f2..5293c7cf8d 100644 --- a/lib/time_rz.c +++ b/lib/time_rz.c @@ -286,6 +286,21 @@ revert_tz (timezone_t tz) struct tm * localtime_rz (timezone_t tz, time_t const *t, struct tm *tm) { +#ifdef HAVE_LOCALTIME_INFLOOP_BUG + /* The -67768038400665599 comes from: + https://lists.gnu.org/r/bug-gnulib/2017-07/msg00142.html + On affected platforms the greatest POSIX-compatible time_t value + that could return nonnull is 67768036191766798 (when + TZ="XXX24:59:59" it resolves to the year 2**31 - 1 + 1900, on + 12-31 at 23:59:59), so test for that too while we're in the + neighborhood. */ + if (! (-67768038400665599 <= *t && *t <= 67768036191766798)) + { + errno = EOVERFLOW; + return NULL; + } +#endif + if (!tz) return gmtime_r (t, tm); else diff --git a/m4/time_rz.m4 b/m4/time_rz.m4 index 4378148978..af9fa02b57 100644 --- a/m4/time_rz.m4 +++ b/m4/time_rz.m4 @@ -13,6 +13,38 @@ AC_DEFUN AC_REQUIRE([gl_HEADER_TIME_H_DEFAULTS]) AC_REQUIRE([AC_STRUCT_TIMEZONE]) + # Mac OS X 10.6 loops forever with some time_t values less + # than -67768038400665599. See Bug#27706, Bug#27736, and + # https://lists.gnu.org/r/bug-gnulib/2017-07/msg00142.html + AC_CACHE_CHECK([whether localtime loops forever near extrema], + [gl_cv_func_localtime_infloop_bug], + [gl_cv_func_localtime_infloop_bug=no + AC_RUN_IFELSE( + [AC_LANG_PROGRAM( + [[#include + #include + #include + #include + ]], [[ + time_t t = -67768038400665600; + struct tm *tm; + char *tz = getenv ("TZ"); + if (! (tz && strcmp (tz, "QQQ0") == 0)) + return 0; + alarm (2); + tm = localtime (&t); + /* Use TM and *TM to suppress over-optimization. */ + return tm && tm->tm_isdst; + ]])], + [TZ=QQQ0 ./conftest$EXEEXT || gl_cv_func_localtime_infloop_bug=yes], + [], + [gl_cv_func_localtime_infloop_bug="guessing no"])]) + if test "$gl_cv_func_localtime_infloop_bug" = yes; then + AC_DEFINE([HAVE_LOCALTIME_INFLOOP_BUG], 1, + [Define if localtime-like functions can loop forever on + extreme arguments.]) + fi + AC_CHECK_TYPES([timezone_t], [], [], [[#include ]]) if test "$ac_cv_type_timezone_t" = yes; then HAVE_TIMEZONE_T=1 -- 2.14.3 --------------7B05822E539B8B3D19976AED Content-Type: text/x-patch; name="0002-Avoid-using-unportable-integer-in-org-clock.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="0002-Avoid-using-unportable-integer-in-org-clock.patch" >From c8e8d16810ec09139c560c77572d3372a2edd8d2 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 27 Mar 2018 13:48:13 -0700 Subject: [PATCH 2/2] Avoid using unportable integer in org-clock * lisp/org/org-clock.el (org-clock--oldest-date): Avoid use of an integer outside portable Emacs range. Go back to using a simple check, since decode-time should no longer infloop. --- lisp/org/org-clock.el | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/lisp/org/org-clock.el b/lisp/org/org-clock.el index 4c5fcc64b0..c124abd391 100644 --- a/lisp/org/org-clock.el +++ b/lisp/org/org-clock.el @@ -478,17 +478,7 @@ org-clock--oldest-date (funcall dichotomy most-negative-fixnum 0 - (lambda (m) - ;; libc in macOS 10.6 hangs when decoding times - ;; around year -2**31. Limit `high' not to go - ;; any earlier than that. - (unless (and (eq system-type 'darwin) - (string-match-p - "10\\.6\\.[[:digit:]]" - (shell-command-to-string - "sw_vers -productVersion")) - (<= m -1034058203135)) - (ignore-errors (decode-time (list m 0))))))) + (lambda (m) (ignore-errors (decode-time (list m 0)))))) (low (funcall dichotomy most-negative-fixnum -- 2.14.3 --------------7B05822E539B8B3D19976AED--