GNU bug report logs - #27706
MacOS: decode-time hang

Previous Next

Package: emacs;

Reported by: "Charles A. Roelli" <charles <at> aurox.ch>

Date: Sat, 15 Jul 2017 14:21:02 UTC

Severity: normal

Merged with 27736

Done: charles <at> aurox.ch (Charles A. Roelli)

Bug is archived. No further changes may be made.

Full log


Message #25 received at 27706 <at> debbugs.gnu.org (full text, mbox):

From: charles <at> aurox.ch (Charles A. Roelli)
To: Noam Postavsky <npostavs <at> users.sourceforge.net>
Cc: alan <at> idiocy.org, 27706 <at> debbugs.gnu.org
Subject: Re: bug#27706: MacOS: decode-time hang
Date: Sun, 01 Oct 2017 11:27:38 +0200
> From: Noam Postavsky <npostavs <at> users.sourceforge.net>
> Date: Sat, 30 Sep 2017 17:21:49 -0400
> 
> Alan Third <alan <at> idiocy.org> writes:
> 
> >     (string-equal system-type "darwin")
> 
> `system-type' contains a symbol, so generally the comparison should look
> like this (unless there is some strong reason to do string comparison)
> 
>     (eq system-type 'darwin)

Thanks to both of you for your help.  Updated patch follows.  I've
also made the check a bit easier to read, and verified that it also
works on the Darwin terminal.

From 7ddfdae2359c07bdddeeeafd69517e02ee3ee2f5 Mon Sep 17 00:00:00 2001
From: "Charles A. Roelli" <charles <at> aurox.ch>
Date: Sat, 30 Sep 2017 20:42:03 +0200
Subject: [PATCH] Workaround for faulty localtime() under macOS 10.6

* lisp/org/org-clock.el (org-clock--oldest-date): Only execute
'decode-time' on times later than year -2**31 under macOS 10.6.
See Bug#27706.
---
 lisp/org/org-clock.el | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/lisp/org/org-clock.el b/lisp/org/org-clock.el
index 8df185d..2eec817 100644
--- a/lisp/org/org-clock.el
+++ b/lisp/org/org-clock.el
@@ -478,7 +478,17 @@ org-clock--oldest-date
 	  (funcall dichotomy
 		   most-negative-fixnum
 		   0
-		   (lambda (m) (ignore-errors (decode-time (list m 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 -1034058203136))
+                       (ignore-errors (decode-time (list m 0)))))))
 	 (low
 	  (funcall dichotomy
 		   most-negative-fixnum
-- 
2.9.4





This bug report was last modified 7 years and 105 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.