unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Arithmetic range error
@ 2019-02-08 10:55 Colin Baxter
  2019-02-08 12:25 ` Robert Pluim
  0 siblings, 1 reply; 12+ messages in thread
From: Colin Baxter @ 2019-02-08 10:55 UTC (permalink / raw)
  To: emacs-devel; +Cc: Kyle Meyer, Nicolas Goaziou


I originally posted an Arithmetic range error using org-publish to
gmane.emacs.orgmode. My original post is
[[gnus:gmane.emacs.orgmode#87ef8jwzs5.fsf@yandex.com][here]].

It was suggested that I also report it to emacs-dev. The error occurs
using org-mode from git and seems to effect emacs-26.1 but not
emacs-27.0.50. With a very inelegant ECM below, I can reproduce the
arithmetic range error. I have tested the ECM on machines running Debian
3.16.0-7-686-pae and Debian 4.9.0-8-686-pae, with the same results.

------ Begin ECM -------------

1. emacs -Q <RET>

2. We need a directory for testing. This ECM uses ~/temp.

3. In the scratch buffer, evaluate the following:

#+begin_src emacs-lisp
(add-to-list 'load-path (expand-file-name "~/path/to/git/org-mode/lisp"))
#+end_src

#+begin_src emacs-lisp
(setq org-publish-project-alist
      '(("org"
         :base-directory "~/temp/"
         :publishing-directory "~/temp"
         :publishing-function org-html-publish-to-html)))
#+end_src

4. Create file ~/temp/test.org.

5. Enter some text (e.g. This is a test) in test.org and save file.

6. M-x org-publish-current-file <RET>.

7. A satisfactory ~/temp/test.html is produced.

8. emacs-26.1 gives 'org-publish-cache-ctime-of-src: Arithmetic range
error: "floor", 1549541220.7500212'

9. emacs-27.0.50 gives no arithmetic range error.

10. Also no errors are produced if emacs-26.1 and emacs-27.0.50 use only
their generic org-modes, namely 'release_9.1.9-65-g5e4542'.

------ End ECM -------------

The issue is apparently triggered by a backport of Emacs's 662bee7d7,
specifically:

* lisp/ox-publish.el (org-publish-cache-ctime-of-src):
Prefer float-time to doing time arithmetic by hand.
[...]
@@ -1364,8 +1366,7 @@ (defun org-publish-cache-ctime-of-src (file)
 	       (expand-file-name (or (file-symlink-p file) file)
 				 (file-name-directory file)))))
     (if (not attr) (error "No such file: \"%s\"" file)
-      (+ (ash (car (nth 5 attr)) 16)
-	 (cadr (nth 5 attr))))))
+      (floor (float-time (file-attribute-modification-time attr))))))


It would appear that the code is sound, but if the above commit is
reversed then the error disappears.

-- 
Colin Baxter
m43cap@yandex.com




^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2019-02-10 12:59 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-02-08 10:55 Arithmetic range error Colin Baxter
2019-02-08 12:25 ` Robert Pluim
2019-02-08 13:05   ` Colin Baxter
2019-02-08 13:15     ` Robert Pluim
2019-02-08 13:19       ` Eli Zaretskii
2019-02-08 13:34         ` Robert Pluim
2019-02-08 14:04           ` Eli Zaretskii
2019-02-08 14:18             ` Robert Pluim
2019-02-08 23:44               ` Nicolas Goaziou
2019-02-09  7:02                 ` Colin Baxter
2019-02-10 10:06                 ` Paul Eggert
2019-02-10 12:59                   ` Nicolas Goaziou

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).