GNU bug report logs - #28921
[PROPOSED] Fix xdg timestamp error on 32-bit Emacs

Previous Next

Package: emacs;

Reported by: Paul Eggert <eggert <at> cs.ucla.edu>

Date: Sat, 21 Oct 2017 03:06:02 UTC

Severity: normal

Done: Paul Eggert <eggert <at> cs.ucla.edu>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 28921 in the body.
You can then email your comments to 28921 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#28921; Package emacs. (Sat, 21 Oct 2017 03:06:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Paul Eggert <eggert <at> cs.ucla.edu>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sat, 21 Oct 2017 03:06:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: bug-gnu-emacs <at> gnu.org,
	mvoteiza <at> udel.edu
Cc: Paul Eggert <eggert <at> cs.ucla.edu>
Subject: [PROPOSED] Fix xdg timestamp error on 32-bit Emacs
Date: Fri, 20 Oct 2017 20:04:55 -0700
* lisp/xdg.el (xdg-thumb-mtime): Return an Emacs timestamp,
not an integer.  This avoids signaling an error on 32-bit
Emacs, where timestamps typically do not fit into fixnums.
---
 lisp/xdg.el | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lisp/xdg.el b/lisp/xdg.el
index 76106f4258..6dcef74e4e 100644
--- a/lisp/xdg.el
+++ b/lisp/xdg.el
@@ -93,8 +93,8 @@ xdg-thumb-name
   (concat (md5 (xdg-thumb-uri filename)) ".png"))
 
 (defun xdg-thumb-mtime (filename)
-  "Return modification time of FILENAME as integral seconds from the epoch."
-  (floor (float-time (nth 5 (file-attributes filename)))))
+  "Return modification time of FILENAME as an Emacs timestamp."
+  (nth 5 (file-attributes filename)))
 
 
 ;; XDG User Directories
-- 
2.13.6





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#28921; Package emacs. (Sat, 21 Oct 2017 07:21:02 GMT) Full text and rfc822 format available.

Message #8 received at 28921 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Paul Eggert <eggert <at> cs.ucla.edu>
Cc: mvoteiza <at> udel.edu, 28921 <at> debbugs.gnu.org
Subject: Re: bug#28921: [PROPOSED] Fix xdg timestamp error on 32-bit Emacs
Date: Sat, 21 Oct 2017 10:19:52 +0300
> From: Paul Eggert <eggert <at> cs.ucla.edu>
> Date: Fri, 20 Oct 2017 20:04:55 -0700
> Cc: Paul Eggert <eggert <at> cs.ucla.edu>
> 
> * lisp/xdg.el (xdg-thumb-mtime): Return an Emacs timestamp,
> not an integer.  This avoids signaling an error on 32-bit
> Emacs, where timestamps typically do not fit into fixnums.

Fine with me for the release branch.

Thanks.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#28921; Package emacs. (Sat, 21 Oct 2017 09:12:02 GMT) Full text and rfc822 format available.

Message #11 received at 28921 <at> debbugs.gnu.org (full text, mbox):

From: Tino Calancha <tino.calancha <at> gmail.com>
To: Paul Eggert <eggert <at> cs.ucla.edu>
Cc: mvoteiza <at> udel.edu, 28921 <at> debbugs.gnu.org
Subject: Re: bug#28921: [PROPOSED] Fix xdg timestamp error on 32-bit Emacs
Date: Sat, 21 Oct 2017 18:11:24 +0900
Paul Eggert <eggert <at> cs.ucla.edu> writes:

>  (defun xdg-thumb-mtime (filename)
> -  "Return modification time of FILENAME as integral seconds from the epoch."
> -  (floor (float-time (nth 5 (file-attributes filename)))))
> +  "Return modification time of FILENAME as an Emacs timestamp."
> +  (nth 5 (file-attributes filename)))
Maybe you could use here the new accesor `file-attribute-modification-time':

diff --git a/lisp/xdg.el b/lisp/xdg.el
index 4250faaeb4..9edc3d2629 100644
--- a/lisp/xdg.el
+++ b/lisp/xdg.el
@@ -94,8 +94,8 @@ xdg-thumb-name
   (concat (md5 (xdg-thumb-uri filename)) ".png"))
 
 (defun xdg-thumb-mtime (filename)
-  "Return modification time of FILENAME as integral seconds from the epoch."
-  (floor (float-time (nth 5 (file-attributes filename)))))
+  "Return modification time of FILENAME as an Emacs timestamp."
+  (file-attribute-modification-time (file-attributes filename)))
 
 
 ;; XDG User Directories




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#28921; Package emacs. (Sat, 21 Oct 2017 14:27:02 GMT) Full text and rfc822 format available.

Message #14 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Mark Oteiza <mvoteiza <at> udel.edu>
To: Paul Eggert <eggert <at> cs.ucla.edu>
Cc: bug-gnu-emacs <at> gnu.org
Subject: Re: [PROPOSED] Fix xdg timestamp error on 32-bit Emacs
Date: Sat, 21 Oct 2017 10:26:30 -0400
On 20/10/17 at 08:04pm, Paul Eggert wrote:
> * lisp/xdg.el (xdg-thumb-mtime): Return an Emacs timestamp,
> not an integer.  This avoids signaling an error on 32-bit
> Emacs, where timestamps typically do not fit into fixnums.

I had the following sitting in my tree, but I don't feel strongly either
way.

diff --git a/lisp/xdg.el b/lisp/xdg.el
index 76106f4258..f57ed5e683 100644
--- a/lisp/xdg.el
+++ b/lisp/xdg.el
@@ -93,8 +93,8 @@ xdg-thumb-name
   (concat (md5 (xdg-thumb-uri filename)) ".png"))
 
 (defun xdg-thumb-mtime (filename)
-  "Return modification time of FILENAME as integral seconds from the epoch."
-  (floor (float-time (nth 5 (file-attributes filename)))))
+  "Return modification time of FILENAME as seconds from the epoch."
+  (ffloor (float-time (nth 5 (file-attributes filename)))))
 
 
 ;; XDG User Directories




Reply sent to Paul Eggert <eggert <at> cs.ucla.edu>:
You have taken responsibility. (Sun, 22 Oct 2017 07:42:01 GMT) Full text and rfc822 format available.

Notification sent to Paul Eggert <eggert <at> cs.ucla.edu>:
bug acknowledged by developer. (Sun, 22 Oct 2017 07:42:02 GMT) Full text and rfc822 format available.

Message #19 received at 28921-done <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Tino Calancha <tino.calancha <at> gmail.com>
Cc: mvoteiza <at> udel.edu, 28921-done <at> debbugs.gnu.org
Subject: Re: bug#28921: [PROPOSED] Fix xdg timestamp error on 32-bit Emacs
Date: Sun, 22 Oct 2017 00:41:08 -0700
Tino Calancha wrote:
> Maybe you could use here the new accesor `file-attribute-modification-time':

Thanks, good idea, I installed it that way into emacs-26. I prefer this to 
float-time because float-time loses information on platforms like GNU/Linux 
where typical file timestamps these days have about 61 bits of precision, which 
is more than the 53 bits that Emacs floats have.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 19 Nov 2017 12:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 7 years and 208 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.