[gnus git] branch master updated: m0-11-34-ga9e39e9 =1= parse-time.el (parse-time-rules), time-date.el (date-to-time): Don't mishandle year-9999 dates (Bug#18176)

Katsumi Yamaoka <[email protected]> Mon, 04 Aug 2014 01:56:54 +0200
Newsgroups gmane.emacs.gnus.cvs
Message-ID <[email protected]>
       via  a9e39e9dc0b816e3ba2798531ccd5e7bcb494075 (commit)
      from  c426f8923d63fba6fbb86db9b59cc9c0e8367ff3 (commit)


- Log -----------------------------------------------------------------
commit a9e39e9dc0b816e3ba2798531ccd5e7bcb494075
Author: Paul Eggert <[email protected]>
Date:   Sun Aug 3 23:56:45 2014 +0000

    parse-time.el (parse-time-rules), time-date.el (date-to-time): Don't mishandle year-9999 dates (Bug#18176)

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index b870994..333c3b6 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,11 @@
+2014-08-03  Paul Eggert  <[email protected]>
+
+	Don't mishandle year-9999 dates (Bug#18176).
+	* parse-time.el (parse-time-rules):
+	Allow years up to most-positive-fixnum.
+	* time-date.el (date-to-time):
+	Pass "Specified time is not representable" errors through.
+
 2014-07-31  Tassilo Horn  <[email protected]>
 
 	* gnus-msg.el (gnus-inews-insert-gcc): Allow `gcc-self' to be a list of
diff --git a/lisp/parse-time.el b/lisp/parse-time.el
index 42b4991..85b8ef1 100644
--- a/lisp/parse-time.el
+++ b/lisp/parse-time.el
@@ -151,7 +151,7 @@
   `(((6) parse-time-weekdays)
     ((3) (1 31))
     ((4) parse-time-months)
-    ((5) (100 4038))
+    ((5) (100 ,most-positive-fixnum))
     ((2 1 0)
      ,#'(lambda () (and (stringp parse-time-elt)
 			(= (length parse-time-elt) 8)
diff --git a/lisp/time-date.el b/lisp/time-date.el
index b04cfcd..48fe229 100644
--- a/lisp/time-date.el
+++ b/lisp/time-date.el
@@ -119,13 +119,20 @@ it is assumed that PICO was omitted and should be treated as zero."
 (defun date-to-time (date)
   "Parse a string DATE that represents a date-time and return a time value.
 If DATE lacks timezone information, GMT is assumed."
-  (condition-case ()
+  (condition-case err
       (apply 'encode-time (parse-time-string date))
-    (error (condition-case ()
+    (error
+     (let ((overflow-error '(error "Specified time is not representable")))
+       (if (equal err overflow-error)
+	   (apply 'signal err)
+	 (condition-case err
 	     (apply 'encode-time
 		    (parse-time-string
 		     (timezone-make-date-arpa-standard date)))
-	     (error (error "Invalid date: %s" date))))))
+	   (error
+	    (if (equal err overflow-error)
+		(apply 'signal err)
+	      (error "Invalid date: %s" date)))))))))
 
 ;; Bit of a mess.  Emacs has float-time since at least 21.1.
 ;; This file is synced to Gnus, and XEmacs packages may have been written

-----------------------------------------------------------------------
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we listed those
revisions in full, above.

Summary of changes:
 lisp/ChangeLog     |    8 ++++++++
 lisp/parse-time.el |    2 +-
 lisp/time-date.el  |   19 +++++++++++++------
 3 files changed, 22 insertions(+), 7 deletions(-)

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Gnus Project".

The branch, master has been updated


hooks/post-receive
-- 
Gnus Project