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: Mon, 12 Aug 2024 14:51:02 +0200 Message-ID: References: <86zfpige7k.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="14192"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 72570@debbugs.gnu.org, Paul Eggert To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Aug 12 14:52:03 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 1sdUWo-0003RU-CP for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 12 Aug 2024 14:52:02 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sdUWU-00084Y-3e; Mon, 12 Aug 2024 08:51:42 -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 1sdUWK-00082B-7b for bug-gnu-emacs@gnu.org; Mon, 12 Aug 2024 08:51:33 -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 1sdUWI-0001is-IE for bug-gnu-emacs@gnu.org; Mon, 12 Aug 2024 08:51:30 -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=zXu4auGQ+qSsHRZbpg+HssgLTUiIMeCUXdMovFqg0rM=; b=BYbdHDRooPsaVRvNbBl81FXncy20393sGgmgPz/A3wr2sMoGjcZVK95zkv2r4ETEr3kF5I+nVIbaMVV+HTYaS6JpQBRm9EXUWQzmlyvek4prMzW348h8iK2/G+2CCERksuESurKrAx41lYM8NoWQnO59vAwJGgxVC6VHW+HUKR2FnrpaqlAv4lPnytYcKEmoe2lvyftF4kf8BWGo3JS0N+QyMsvQc4fz7L/duOGakt4vHIPFs17xXfjUvBWcbDE8lliRx1Xd2LkLnqYpGiz1SF+oik2cDWEu/wYUEMBA0R8U/f0Pi9MNtvAcsEcxBBwDX0umE/Eyal+aUvp0RlNZYA==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sdUWo-0003cq-H2 for bug-gnu-emacs@gnu.org; Mon, 12 Aug 2024 08:52:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Ulrich Mueller Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 12 Aug 2024 12:52:02 +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.172346711013912 (code B ref 72570); Mon, 12 Aug 2024 12:52:02 +0000 Original-Received: (at 72570) by debbugs.gnu.org; 12 Aug 2024 12:51:50 +0000 Original-Received: from localhost ([127.0.0.1]:42617 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sdUWb-0003cK-Om for submit@debbugs.gnu.org; Mon, 12 Aug 2024 08:51:50 -0400 Original-Received: from woodpecker.gentoo.org ([140.211.166.183]:52686 helo=smtp.gentoo.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sdUWa-0003c6-Pz for 72570@debbugs.gnu.org; Mon, 12 Aug 2024 08:51:49 -0400 In-Reply-To: <86zfpige7k.fsf@gnu.org> (Eli Zaretskii's message of "Mon, 12 Aug 2024 14:42:07 +0300") 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:290046 Archived-At: >>>>> On Mon, 12 Aug 2024, Eli Zaretskii wrote: > That commit made this change in date-to-time: > - (apply 'encode-time > - (parse-time-string > - ;; `parse-time-string' isn't sufficiently general or > - ;; robust. It fails to grok some of the formats that > - ;; timezone does (e.g. dodgy post-2000 stuff from some > - ;; Elms) and either fails or returns bogus values. Lars > - ;; reverted this change, but that loses non-trivially > - ;; often for me. -- fx > - (timezone-make-date-arpa-standard date))) > - (error (error "Invalid date: %s" date)))) > + (apply 'encode-time (parse-time-string date)) > + (error (condition-case () > + (apply 'encode-time > + (parse-time-string > + (timezone-make-date-arpa-standard date))) > + (error (error "Invalid date: %s" date)))))) > IOW, it applied parse-time-string to the argument DATE instead of > first running it through timezone-make-date-arpa-standard. Which is still present as a fallback, if parse-time-string either errors out, or doesn't return a useful date. One problem is that the initial parse-time-string code defaults to local time (contrary to what is documented), while the timezone-make-date-arpa-standard fallback code defaults to UTC. > But that is not necessarily incorrect, because several time-conversion > functions, including those involved in this issue, don't document > their assumptions about time-zone when it is omitted. This includes > parse-time-string and iso8601-parse. Since these functions don't > document this aspect, and the code involved in the above snippet is > quite convoluted, it is hard for me to decide which part of what > function needs to be fixed. Well, parse-time-string doesn't make any assumptions about the timezone. It will return a list with nil in its TZ element, if it cannot extract any timezone info from the string. Same for iso8601-parse, the returned TZ is nil if it is not present in the argument string. Examples: (iso8601-parse "2024-08-12T00:00:00") -> (0 0 0 12 8 2024 nil -1 nil) (iso8601-parse "2024-08-12T00:00:00Z") -> (0 0 0 12 8 2024 nil nil 0) (iso8601-parse "2024-08-12T00:00:00+0200") -> (0 0 0 12 8 2024 nil -1 7200)