GNU bug report logs -
#27706
MacOS: decode-time hang
Previous Next
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 27706 in the body.
You can then email your comments to 27706 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#27706
; Package
emacs
.
(Sat, 15 Jul 2017 14:21:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
"Charles A. Roelli" <charles <at> aurox.ch>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Sat, 15 Jul 2017 14:21:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
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):
(gdb) bt full
#0 0x00007fff83860aef in timesub () from /usr/lib/libSystem.B.dylib
No symbol table info available.
#1 0x00007fff8386081c in _st_localsub () from /usr/lib/libSystem.B.dylib
No symbol table info available.
#2 0x00007fff83869d71 in localtime_r () from /usr/lib/libSystem.B.dylib
No symbol table info available.
#3 0x00000001004586c7 in localtime_rz (tz=0x10210bba0,
t=0x7fff5fbf8d20, tm=0x7fff5fbf8ce8) at time_rz.c:296
abbr_saved = false
old_tz = 0x1
#4 0x00000001002ba08b in emacs_localtime_rz (tz=0x10210bba0,
t=0x7fff5fbf8d20, tm=0x7fff5fbf8ce8) at editfns.c:103
No locals.
#5 0x00000001002c2680 in Fdecode_time (specified_time=..., zone=...) at
editfns.c:2163
time_spec = -67768038400720896
gmt_tm = {
tm_sec = 1606388960,
tm_min = 32767,
tm_hour = 1766166,
tm_mday = 1,
tm_mon = 0,
tm_year = 0,
tm_wday = 0,
tm_yday = 0,
tm_isdst = 0,
tm_gmtoff = 10261984,
tm_zone = 0x7fff5fbf8d30 "`\215\277_\377\177"
}
tz = 0x10210bba0
local_tm = {
tm_sec = 24,
tm_min = 38,
tm_hour = 8,
tm_mday = 32767,
tm_mon = 0,
tm_year = 0,
tm_wday = 0,
tm_yday = 0,
tm_isdst = 0,
tm_gmtoff = 0,
tm_zone = 0x0
}
tm = 0x0
tm_year_base = 0
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.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#27706
; Package
emacs
.
(Sat, 15 Jul 2017 21:33:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 27706 <at> debbugs.gnu.org (full text, mbox):
On Sat, Jul 15, 2017 at 04:19:39PM +0200, Charles A. Roelli wrote:
> 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]
I can’t reproduce in 10.12.
--
Alan Third
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#27706
; Package
emacs
.
(Sun, 16 Jul 2017 16:12:02 GMT)
Full text and
rfc822 format available.
Message #11 received at 27706 <at> debbugs.gnu.org (full text, mbox):
Thanks for testing it.
> On 15 Jul 2017, at 23:32, Alan Third <alan <at> idiocy.org> wrote:
>
>> On Sat, Jul 15, 2017 at 04:19:39PM +0200, Charles A. Roelli wrote:
>> 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]
>
> I can’t reproduce in 10.12.
> --
> Alan Third
Merged 27706 27736.
Request was from
Alan Third <alan <at> idiocy.org>
to
control <at> debbugs.gnu.org
.
(Mon, 17 Jul 2017 19:45:02 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#27706
; Package
emacs
.
(Sat, 30 Sep 2017 19:10:02 GMT)
Full text and
rfc822 format available.
Message #16 received at 27706 <at> debbugs.gnu.org (full text, mbox):
> From: "Charles A. Roelli" <charles <at> 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 <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 | 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
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#27706
; Package
emacs
.
(Sat, 30 Sep 2017 20:22:02 GMT)
Full text and
rfc822 format available.
Message #19 received at 27706 <at> debbugs.gnu.org (full text, mbox):
On Sat, Sep 30, 2017 at 09:09:08PM +0200, Charles A. Roelli wrote:
> + (if (and (featurep 'ns)
> + (string-match-p
> + "10\\.6\\.[[:digit:]]"
> + (shell-command-to-string
> + "sw_vers -productVersion")))
I can’t speak for the issue generally as I don’t know what this code
does, but this particular check looks incorrect to me.
sw_vers doesn’t exist on GNU/Linux, and probably other platforms that
GNUstep runs on, so you can’t just use a check for NS. Probably you
need to check for Darwin, which should work on terminal only versions
of Emacs too.
(string-equal system-type "darwin")
(There may be other ways to check, this is the only one I know.)
--
Alan Third
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#27706
; Package
emacs
.
(Sat, 30 Sep 2017 21:22:02 GMT)
Full text and
rfc822 format available.
Message #22 received at 27706 <at> debbugs.gnu.org (full text, mbox):
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)
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#27706
; Package
emacs
.
(Sun, 01 Oct 2017 09:29:01 GMT)
Full text and
rfc822 format available.
Message #25 received at 27706 <at> debbugs.gnu.org (full text, mbox):
> 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
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#27706
; Package
emacs
.
(Sun, 01 Oct 2017 17:12:01 GMT)
Full text and
rfc822 format available.
Message #28 received at 27706 <at> debbugs.gnu.org (full text, mbox):
I pushed the fix to emacs-26:
commit bd49b6f1b39cffeaf6098bc7b0182552683b1c07
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.
I'll close this bug in the next few days.
Reply sent
to
charles <at> aurox.ch (Charles A. Roelli)
:
You have taken responsibility.
(Sat, 07 Oct 2017 15:34:01 GMT)
Full text and
rfc822 format available.
Notification sent
to
"Charles A. Roelli" <charles <at> aurox.ch>
:
bug acknowledged by developer.
(Sat, 07 Oct 2017 15:34:01 GMT)
Full text and
rfc822 format available.
Message #33 received at 27706-done <at> debbugs.gnu.org (full text, mbox):
> Date: Sun, 01 Oct 2017 19:11:01 +0200
> From: charles <at> aurox.ch (Charles A. Roelli)
> CC: npostavs <at> users.sourceforge.net, alan <at> idiocy.org
>
> I pushed the fix to emacs-26:
>
> commit bd49b6f1b39cffeaf6098bc7b0182552683b1c07
>
> 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.
>
> I'll close this bug in the next few days.
Works, closing.
Reply sent
to
charles <at> aurox.ch (Charles A. Roelli)
:
You have taken responsibility.
(Sat, 07 Oct 2017 15:34:02 GMT)
Full text and
rfc822 format available.
Notification sent
to
Keith David Bershatsky <esq <at> lawlist.com>
:
bug acknowledged by developer.
(Sat, 07 Oct 2017 15:34:02 GMT)
Full text and
rfc822 format available.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Sun, 05 Nov 2017 12:24:03 GMT)
Full text and
rfc822 format available.
bug unarchived.
Request was from
Keith David Bershatsky <esq <at> lawlist.com>
to
control <at> debbugs.gnu.org
.
(Sun, 05 Nov 2017 18:01:01 GMT)
Full text and
rfc822 format available.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Thu, 07 Dec 2017 12:24:03 GMT)
Full text and
rfc822 format available.
bug unarchived.
Request was from
Paul Eggert <eggert <at> cs.ucla.edu>
to
control <at> debbugs.gnu.org
.
(Tue, 27 Mar 2018 20:51:02 GMT)
Full text and
rfc822 format available.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Mon, 30 Apr 2018 11:24:04 GMT)
Full text and
rfc822 format available.
This bug report was last modified 5 years and 362 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.