From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Ulrich Mueller Newsgroups: gmane.emacs.bugs Subject: bug#72570: 31.0.50; Regression in date-to-time Date: Wed, 14 Aug 2024 10:12:35 +0200 Message-ID: References: <86zfpige7k.fsf@gnu.org> <892ebc72-1020-471a-bdcd-8e8da10d61dd@cs.ucla.edu> <55718663-6c04-4f97-b3cb-122c924895c2@cs.ucla.edu> <1513da6b-20a3-4033-b433-6f13b38c348d@cs.ucla.edu> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="18650"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Eli Zaretskii , 72570@debbugs.gnu.org To: Paul Eggert Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Aug 14 10:13:52 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1se98h-0004fZ-Mc for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 14 Aug 2024 10:13:51 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1se98N-0004fe-FT; Wed, 14 Aug 2024 04:13:31 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1se98J-0004ZN-G8 for bug-gnu-emacs@gnu.org; Wed, 14 Aug 2024 04:13:29 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1se98J-0001qt-75 for bug-gnu-emacs@gnu.org; Wed, 14 Aug 2024 04:13:27 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:References:In-Reply-To:From:To:Subject; bh=i7uAuDVoZKShlxd0jnNJQ5KTDFRXD8PGpjkiReomWBs=; b=pqHSwtAlhoQ+xm2us1XSmTv70aokvffI6d+JqfRLVAkWV7mg4O/NM4rxBP1w2DwT7sx1j6hlrn8qFr+p2M2/fdBwk6UjIBQzPQpRVGDsIOfT2tpEtu6kdlilfe4ioxUMJKj5ZfTgB+wfEbLJtxG18f7yBSkUii8yFlkXygpYsusMEomqnlDiI3ij9sGi9PuR1BplB2mPJVce4wgKbPacXj/hAlYLoELERMEQ+nwyiqizDpB4CEhOW6RcK+j8dR1N8TMJPY36+tKxslxuMUwYTw2WGjkgYuathUTdqMsgRUElrtZijnkHZ9P/fy53kNLbUL7avhfabfUrnPg11Auy+g==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1se98r-0004A6-Ld for bug-gnu-emacs@gnu.org; Wed, 14 Aug 2024 04:14:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Ulrich Mueller Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 14 Aug 2024 08:14:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 72570 X-GNU-PR-Package: emacs Original-Received: via spool by 72570-submit@debbugs.gnu.org id=B72570.172362320415942 (code B ref 72570); Wed, 14 Aug 2024 08:14:01 +0000 Original-Received: (at 72570) by debbugs.gnu.org; 14 Aug 2024 08:13:24 +0000 Original-Received: from localhost ([127.0.0.1]:46035 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1se98F-000494-Qg for submit@debbugs.gnu.org; Wed, 14 Aug 2024 04:13:24 -0400 Original-Received: from woodpecker.gentoo.org ([140.211.166.183]:35932 helo=smtp.gentoo.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1se98D-00048r-Rx for 72570@debbugs.gnu.org; Wed, 14 Aug 2024 04:13:22 -0400 In-Reply-To: <1513da6b-20a3-4033-b433-6f13b38c348d@cs.ucla.edu> (Paul Eggert's message of "Tue, 13 Aug 2024 14:19:06 -0700") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:290123 Archived-At: --=-=-= Content-Type: text/plain >>>>> On Tue, 13 Aug 2024, Paul Eggert wrote: > On 2024-08-13 14:11, Ulrich Mueller wrote: >> (Assuming that the fallback code is still needed today. >> From commit history in the Gnus repository, it looks like the call to >> timezone-make-date-arpa-standard was first added on 2000-01-06 in >> https://github.com/dabrahams/gnus/commit/f1c5b21410f6e574913bbcf97ffd5e98d9ab89ac#diff-c8e4386c2f71d2573b4b5e6549e54c51cdf1fa649c6578ebd377f84e27576c93L32 . >> The rationale for the change was to make the function "... more robust, >> e.g. against the crop of year 100 dates in Jan 2000".) > If that's the only reason it's there, we can simply remove the call to > timezone-make-date-arpa-standard. That would be better to coating the > pig with even more lipstick. IIUC timezone-parse-date is the function that is used for parsing a date in the fallback code. Its function documentation says: | Understands the following styles: | (1) 14 Apr 89 03:20[:12] [GMT] | (2) Fri, 17 Mar 89 4:01[:33] [GMT] | (3) Mon Jan 16 16:12[:37] [GMT] 1989 | (4) 6 May 1992 1641-JST (Wednesday) | (5) 22-AUG-1993 10:59:12.82 | (6) Thu, 11 Apr 16:17:12 91 [MET] | (7) Mon, 6 Jul 16:47:20 T 1992 [MET] | (8) 1996-06-24 21:13:12 [GMT] | (9) 1996-06-24 21:13-ZONE | (10) 19960624T211312 I've used these to make some test cases for ERT, see the attached file. The current date-to-time correctly handles styles 1, 2, 3, 6 (without timezone), 7 (without timezone), 8, and 10. It returns an incorrect result for styles 4, 5, 6 (with timezone), 7 (with timezone), and 9. If I redefine date-to-time with the fallback code removed, the test results are identical (somewhat surprisingly). So I'd conclude that we don't gain much from the fallback code. --=-=-= Content-Type: text/plain Content-Disposition: inline; filename=test-date-to-time.el (ert-deftest test-date-to-time () ;; Test cases are the formats mentioned in the docstring ;; of timezone-parse-date (let ((date-list '(("14 Apr 89 03:20" (00 20 03 14 04 1989 nil -1 nil)) ("14 Apr 89 03:20:12" (12 20 03 14 04 1989 nil -1 nil)) ("14 Apr 89 03:20 GMT" (00 20 03 14 04 1989 nil nil 0)) ("14 Apr 89 03:20:12 GMT" (12 20 03 14 04 1989 nil nil 0)) ("Fri, 17 Mar 89 4:01" (00 01 04 17 03 1989 nil -1 nil)) ("Fri, 17 Mar 89 4:01:33" (33 01 04 17 03 1989 nil -1 nil)) ("Fri, 17 Mar 89 4:01 GMT" (00 01 04 17 03 1989 nil nil 0)) ("Fri, 17 Mar 89 4:01:33 GMT" (33 01 04 17 03 1989 nil nil 0)) ("Mon Jan 16 16:12 1989" (00 12 16 16 01 1989 nil -1 nil)) ("Mon Jan 16 16:12:37 1989" (37 12 16 16 01 1989 nil -1 nil)) ("Mon Jan 16 16:12 GMT 1989" (00 12 16 16 01 1989 nil nil 0)) ("Mon Jan 16 16:12:37 GMT 1989" (37 12 16 16 01 1989 nil nil 0)) ("Thu, 11 Apr 16:17:12 91" (12 17 16 11 04 1991 nil -1 nil)) ("Mon, 6 Jul 16:47:20 T 1992" (20 47 16 06 07 1992 nil -1 nil)) ("1996-06-24 21:13:12" (12 13 21 24 06 1996 nil -1 nil)) ("1996-06-24 21:13:12 GMT" (12 13 21 24 06 1996 nil nil 0)) ("19960624t211312" (12 13 21 24 06 1996 nil -1 nil)) ;; fails to parse time, returns 00:00:00 ;("6 May 1992 1641-JST (Wednesday)" ; (00 41 16 06 05 1992 nil nil 32400)) ;; parses date incorrectly as 1982-01-01 ;("22-AUG-1993 10:59:12.82" (12 59 10 22 08 1993 nil -1 nil)) ;; fails to parse timezone ;("Thu, 11 Apr 16:17:12 91 MET" (12 17 16 11 04 1991 nil nil 3600)) ;("Mon, 6 Jul 16:47:20 T 1992 MET" ; (20 47 16 06 07 1992 nil nil 3600)) ;; fails to parse time, returns 00:00:00 ;("1996-06-24 21:13-JST" (00 13 21 24 06 1996 nil nil 32400)) )) (process-environment (copy-sequence process-environment)) (tz (getenv "TZ"))) (unwind-protect (progn (setenv "TZ" "UTC") (dolist (date date-list) (should (equal (date-to-time (car date)) (encode-time (cadr date)))))) ;; This is needed because setenv handles TZ specially. ;; So, restoring the environment is not enough. (setenv "TZ" tz)))) --=-=-=--