20270656 calc: sign change of hh.mm value puts Emacs into tight loop
authorAli Bahrami <Ali.Bahrami@Oracle.COM>
Tue, 13 Jan 2015 10:04:39 -0700
changeset 3626 48d8d7ae6e0a
parent 3625 43b658b2e7cf
child 3628 d165e4d5af9a
20270656 calc: sign change of hh.mm value puts Emacs into tight loop
components/emacs/README
components/emacs/patches/calc-forms.patch
--- a/components/emacs/README	Tue Jan 13 07:55:43 2015 -0800
+++ b/components/emacs/README	Tue Jan 13 10:04:39 2015 -0700
@@ -18,7 +18,7 @@
 #
 # CDDL HEADER END
 #
-# Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.
 #
 
 NAME:             emacs
@@ -36,6 +36,13 @@
 
 - We patch the following changes to the emacs sources:
 
+	calc-forms.patch
+	    calc has a flaw that puts the X11 versions of emacs into a
+            tight loop. This patch comes from the calc maintainer. The
+	    fix was applied to the GNU emacs "master" branch, in September
+	    2014. It will be in version 25.1. We should be able to drop
+	    this patch when we upgrade to, or past, that release.
+
 	face_for_font.patch
 	    xdisp.c has a call to face_for_font(), a function that is
 	    only present when window system support is included, which is
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/emacs/patches/calc-forms.patch	Tue Jan 13 10:04:39 2015 -0700
@@ -0,0 +1,18 @@
+# Prevent uninterruptible infinite loop. This is the fix for
+#    20270656 calc: sign change of hh.mm value puts Emacs into tight loop
+# See components/emacs/README.
+#
+--- emacs-24.3.orig/lisp/calc/calc-forms.el	2013-01-01 13:37:17.000000000 -0700
++++ emacs-24.3/lisp/calc/calc-forms.el	2015-01-02 14:57:36.824358166 -0700
[email protected]@ -271,7 +271,10 @@
+ 	(m (math-normalize (nth 2 a)))
+ 	(s (let ((calc-internal-prec (max (- calc-internal-prec 4) 3)))
+ 	     (math-normalize (nth 3 a)))))
+-    (if (math-negp h)
++    (if (or 
++         (math-negp h)
++         (and (= h 0) (math-negp m))
++         (and (= h 0) (= m 0) (math-negp s)))
+ 	(progn
+ 	  (if (math-posp s)
+ 	      (setq s (math-add s -60)