From: charles@aurox.ch (Charles A. Roelli)
To: 27706@debbugs.gnu.org
Subject: bug#27706: MacOS: decode-time hang
Date: Sat, 30 Sep 2017 21:09:08 +0200 [thread overview]
Message-ID: <m2zi9cknqj.fsf@aurox.ch> (raw)
In-Reply-To: <okd89l$tfu$1@blaine.gmane.org> (charles@aurox.ch)
> From: "Charles A. Roelli" <charles@aurox.ch>
> Date: Sat, 15 Jul 2017 16:19:39 +0200
>
> Evaluating the following form on my system (macOS 10.6) results in a
> hang from Emacs 23 to master:
>
> (decode-time '(-1034058203136 0))
>
> [other values around -1034058203136 don't cause an issue]
>
> The stack trace (stuck in macOS' libc, I think):
>
> [...]
>
> The form is called when compiling the new org-timer.el, which requires
> org-clock.el, which itself contains this call that causes the issue:
>
> (defconst org-clock--oldest-date
> (let* ((dichotomy
> (lambda (min max pred)
> (if (funcall pred min) min
> (cl-incf min)
> (while (> (- max min) 1)
> (let ((mean (+ (ash min -1) (ash max -1) (logand min max 1))))
> (if (funcall pred mean) (setq max mean) (setq min mean)))))
> max))
> (high
> (funcall dichotomy
> most-negative-fixnum
> 0
> (lambda (m) (ignore-errors (decode-time (list m 0))))))
> (low
> (funcall dichotomy
> most-negative-fixnum
> 0
> (lambda (m) (ignore-errors (decode-time (list high m)))))))
> (list high low))
> "Internal time for oldest date representable on the system.")
>
> As a result, "make" hangs for me, so I delete org-timer.el locally to
> get around the problem for now. But I'd like to find a more permanent
> solution to make sure this doesn't happen elsewhere.
>
> Can anyone reproduce this under macOS, and if so, under which macOS
> version? I'd like to know which versions might need a fix for this
> problem.
I'd like to fix this for emacs-26. Is this fix okay to apply?
From b7a871e126b6e2036dbbe81b5c8b36bfbf6da419 Mon Sep 17 00:00:00 2001
From: "Charles A. Roelli" <charles@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 | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/lisp/org/org-clock.el b/lisp/org/org-clock.el
index 8df185d..97d9612 100644
--- a/lisp/org/org-clock.el
+++ b/lisp/org/org-clock.el
@@ -478,7 +478,18 @@ 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.
+ (if (and (featurep 'ns)
+ (string-match-p
+ "10\\.6\\.[[:digit:]]"
+ (shell-command-to-string
+ "sw_vers -productVersion")))
+ (if (> m -1034058203136)
+ (ignore-errors (decode-time (list m 0))))
+ (ignore-errors (decode-time (list m 0)))))))
(low
(funcall dichotomy
most-negative-fixnum
--
2.9.4
next prev parent reply other threads:[~2017-09-30 19:09 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-15 14:19 bug#27706: MacOS: decode-time hang Charles A. Roelli
2017-07-15 21:32 ` Alan Third
2017-07-16 16:11 ` Charles A. Roelli
2017-09-30 19:09 ` Charles A. Roelli [this message]
2017-09-30 20:21 ` Alan Third
2017-09-30 21:21 ` Noam Postavsky
2017-10-01 9:27 ` Charles A. Roelli
2017-10-01 17:11 ` Charles A. Roelli
2017-10-07 15:33 ` Charles A. Roelli
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m2zi9cknqj.fsf@aurox.ch \
--to=charles@aurox.ch \
--cc=27706@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.