Re: [O] Arithmetic range error

2019-02-08 Thread Colin Baxter
> "Kyle" == Kyle Meyer  writes:

Kyle> Nicolas Goaziou  writes:
>> Colin Baxter  writes:
>> 
>>> I can now confirm that if the above commit is reversed then my
>>> Arithmetic range error disappears.
>>> 
>>> diff --git a/lisp/ox-publish.el b/lisp/ox-publish.el index
>>> d9fc8d2..2144aa1 100644 --- a/lisp/ox-publish.el +++
>>> b/lisp/ox-publish.el @@ -1366,7 +1366,9 @@ does not exist."
>>> (expand-file-name (or (file-symlink-p file) file)
>>> (file-name-directory file) (if (not attr) (error "No such
>>> file: \"%s\"" file) - (floor (float-time
>>> (file-attribute-modification-time attr)) + (+ (ash (car (nth
>>> 5 attr)) 16) + (cadr (nth 5 attr)) +;; (floor (float-time
>>> (file-attribute-modification-time attr))
>> 
>> I think it is worth reporting it to Emacs devel list, because the
>> commented code doesn't look wrong.

Kyle> And in the report it'd be good to include some of the
Kyle> information asked for elsewhere in this thread (full
Kyle> backtrace, system details) as well as a recipe to reproduce.
Kyle> I haven't had any luck triggering the issue, but that's
Kyle> unsurprisingly given that the code looks correct and the
Kyle> number reported in the error isn't extreme:

Kyle> (floor 1549541220.7500212) ; => 1549541220
Kyle> (format-time-string "%Y-%m-%d %I:%M:%S" (seconds-to-time
Kyle> 1549541220.7500212)) ; => "2019-02-07 07:07:00"

With a very inelegant ECM below, I can reproduce the arithmetic range
error in emacs-26.1 but not in the development emacs-27.0.50. I have
tested the ECM on machines running Debian 3.16.0-7-686-pae and
4.9.0-8-686-pae, with the same results.

1. emacs -Q 

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 .

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

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

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'.

I hope to post a report to emacs-dev later today.

Best wishes,

-- 
Colin Baxter
m43...@yandex.com



Re: [O] Arithmetic range error

2019-02-07 Thread Kyle Meyer
Nicolas Goaziou  writes:

> Colin Baxter  writes:
>
>> I can now confirm that if the above commit is reversed then my
>> Arithmetic range error disappears.
>>
>> diff --git a/lisp/ox-publish.el b/lisp/ox-publish.el
>> index d9fc8d2..2144aa1 100644
>> --- a/lisp/ox-publish.el
>> +++ b/lisp/ox-publish.el
>> @@ -1366,7 +1366,9 @@ does not exist."
>> (expand-file-name (or (file-symlink-p file) file)
>>   (file-name-directory file)
>>  (if (not attr) (error "No such file: \"%s\"" file)
>> -  (floor (float-time (file-attribute-modification-time attr))
>> +  (+ (ash (car (nth 5 attr)) 16)
>> + (cadr (nth 5 attr))
>> +;;  (floor (float-time (file-attribute-modification-time attr))
>
> I think it is worth reporting it to Emacs devel list, because the
> commented code doesn't look wrong.

And in the report it'd be good to include some of the information asked
for elsewhere in this thread (full backtrace, system details) as well as
a recipe to reproduce.  I haven't had any luck triggering the issue,
but that's unsurprisingly given that the code looks correct and the
number reported in the error isn't extreme:

(floor 1549541220.7500212) ; => 1549541220
(format-time-string
 "%Y-%m-%d %I:%M:%S"
 (seconds-to-time 1549541220.7500212)) ; => "2019-02-07 07:07:00"

-- 
Kyle



Re: [O] Arithmetic range error

2019-02-07 Thread Nicolas Goaziou
Hello,

Colin Baxter  writes:

> I can now confirm that if the above commit is reversed then my
> Arithmetic range error disappears.
>
> diff --git a/lisp/ox-publish.el b/lisp/ox-publish.el
> index d9fc8d2..2144aa1 100644
> --- a/lisp/ox-publish.el
> +++ b/lisp/ox-publish.el
> @@ -1366,7 +1366,9 @@ does not exist."
>  (expand-file-name (or (file-symlink-p file) file)
>(file-name-directory file)
>  (if (not attr) (error "No such file: \"%s\"" file)
> -  (floor (float-time (file-attribute-modification-time attr))
> +  (+ (ash (car (nth 5 attr)) 16)
> +  (cadr (nth 5 attr))
> +;;  (floor (float-time (file-attribute-modification-time attr))

I think it is worth reporting it to Emacs devel list, because the
commented code doesn't look wrong.

Regards,

-- 
Nicolas Goaziou



Re: [O] Arithmetic range error

2019-02-07 Thread Colin Baxter
> Kyle Meyer  writes:

> Colin Baxter  writes:
>> Publishing an org file today, the html output looks ok but I get
>> the compilation error:
>> 
>> Arithmetic range error: "floor", 1549541220.7500212
>> 
>> I get the error with org-version 9.2.1
>> (release_9.2.1-200-g18b85a) but not with org-version 8.2.10.
>> 
>> Looking at 'org-publish-cache-ctime-of-src' in the file
>> `ox-publish.el', its not obvious to me where the error is coming
>> from. Ditto after looking in NEWS and the git commit logs.
>> 
>> Can anyone help?

> This looks to be due to the 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))

> I won't have a chance to investigate further though until (my EST)
> tonight.

I can now confirm that if the above commit is reversed then my
Arithmetic range error disappears.

diff --git a/lisp/ox-publish.el b/lisp/ox-publish.el
index d9fc8d2..2144aa1 100644
--- a/lisp/ox-publish.el
+++ b/lisp/ox-publish.el
@@ -1366,7 +1366,9 @@ does not exist."
 	   (expand-file-name (or (file-symlink-p file) file)
  (file-name-directory file)
 (if (not attr) (error "No such file: \"%s\"" file)
-  (floor (float-time (file-attribute-modification-time attr))
+  (+ (ash (car (nth 5 attr)) 16)
+	 (cadr (nth 5 attr))
+;;  (floor (float-time (file-attribute-modification-time attr))
 
 
 (provide 'ox-publish)

Best wishes,

Colin Baxter
m43...@yandex.com


Re: [O] Arithmetic range error

2019-02-07 Thread Colin Baxter
> "Colin" == Colin Baxter  writes:

> Kyle Meyer  writes:
>> Colin Baxter  writes:
>>> Publishing an org file today, the html output looks ok but I get
>>> the compilation error:
>>> 
>>> Arithmetic range error: "floor", 1549541220.7500212
>>> 
>>> I get the error with org-version 9.2.1
>>> (release_9.2.1-200-g18b85a) but not with org-version 8.2.10.
>>> 
>>> Looking at 'org-publish-cache-ctime-of-src' in the file
>>> `ox-publish.el', its not obvious to me where the error is coming
>>> from. Ditto after looking in NEWS and the git commit logs.
>>> 
>>> Can anyone help?

>> This looks to be due to the 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))

>> I won't have a chance to investigate further though until (my
>> EST) tonight.

Colin> Thank you to everybody for your replies. I can't revert the
Colin> commit myself; there seems to be unmerged files in the work
Colin> tree and this goes beyond my knowledge of git. Interestingly,
Colin> the above additions and subtractions to lisp/ox-publish.el
Colin> actually seem to be missing from my ox-publish.el (lines
Colin> 1361--1368).

Please ignore my last sentence - it's nonsense - sorry.

Best wishes,
 
Colin Baxter
m43...@yandex.com




Re: [O] Arithmetic range error

2019-02-07 Thread Colin Baxter
> Kyle Meyer  writes:

> Colin Baxter  writes:
>> Publishing an org file today, the html output looks ok but I get
>> the compilation error:
>> 
>> Arithmetic range error: "floor", 1549541220.7500212
>> 
>> I get the error with org-version 9.2.1
>> (release_9.2.1-200-g18b85a) but not with org-version 8.2.10.
>> 
>> Looking at 'org-publish-cache-ctime-of-src' in the file
>> `ox-publish.el', its not obvious to me where the error is coming
>> from. Ditto after looking in NEWS and the git commit logs.
>> 
>> Can anyone help?

> This looks to be due to the 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))

> I won't have a chance to investigate further though until (my EST)
> tonight.

Thank you to everybody for your replies. I can't revert the commit
myself; there seems to be unmerged files in the work tree and this
goes beyond my knowledge of git. Interestingly, the above additions and
subtractions to lisp/ox-publish.el actually seem to be missing from my
ox-publish.el (lines 1361--1368).

Best wishes,

Colin Baxter
m43...@yandex.com



Re: [O] Arithmetic range error

2019-02-07 Thread Nicolas Goaziou
Hello,

Colin Baxter  writes:

> Publishing an org file today, the html output looks ok but I get the
> compilation error:
>
> Arithmetic range error: "floor", 1549541220.7500212
>
> I get the error with org-version 9.2.1 (release_9.2.1-200-g18b85a)
> but not with org-version 8.2.10.
>
> Looking at 'org-publish-cache-ctime-of-src' in the file `ox-publish.el',
> its not obvious to me where the error is coming from. Ditto after
> looking in NEWS and the git commit logs.
>
> Can anyone help?

It would be nice to get the full backtrace.

Also, does commit d64c9a996b look suspicious?

Regards,

-- 
Nicolas Goaziou



Re: [O] Arithmetic range error

2019-02-07 Thread Robert Pluim
Colin Baxter  writes:

> Hello,
>
> Publishing an org file today, the html output looks ok but I get the
> compilation error:
>
> Arithmetic range error: "floor", 1549541220.7500212
>
> I get the error with org-version 9.2.1 (release_9.2.1-200-g18b85a)
> but not with org-version 8.2.10.
>
> Looking at 'org-publish-cache-ctime-of-src' in the file `ox-publish.el',
> its not obvious to me where the error is coming from. Ditto after
> looking in NEWS and the git commit logs.

Thatʼs emacs signalling that thereʼs an overflow when converting that
float to an integer. It seems much too small for that, though. Which
version of emacs is this, on what platform?

Robert



Re: [O] Arithmetic range error

2019-02-07 Thread Kyle Meyer
Colin Baxter  writes:

> Publishing an org file today, the html output looks ok but I get the
> compilation error:
>
> Arithmetic range error: "floor", 1549541220.7500212
>
> I get the error with org-version 9.2.1 (release_9.2.1-200-g18b85a)
> but not with org-version 8.2.10.
>
> Looking at 'org-publish-cache-ctime-of-src' in the file `ox-publish.el',
> its not obvious to me where the error is coming from. Ditto after
> looking in NEWS and the git commit logs.
>
> Can anyone help?

This looks to be due to the backport of Emacs's 662bee7d7,
specifically:

--8<---cut here---start->8---
* 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))
--8<---cut here---end--->8---

I won't have a chance to investigate further though until (my EST)
tonight.