From debbugs-submit-bounces@debbugs.gnu.org Fri Nov 13 09:02:18 2015 Received: (at submit) by debbugs.gnu.org; 13 Nov 2015 14:02:18 +0000 Received: from localhost ([127.0.0.1]:36771 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZxEvi-0001ug-Eq for submit@debbugs.gnu.org; Fri, 13 Nov 2015 09:02:18 -0500 Received: from eggs.gnu.org ([208.118.235.92]:41395) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZxEvg-0001uY-BR for submit@debbugs.gnu.org; Fri, 13 Nov 2015 09:02:17 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZxEva-00051X-NH for submit@debbugs.gnu.org; Fri, 13 Nov 2015 09:02:16 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50 autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:58664) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZxEva-00051T-K9 for submit@debbugs.gnu.org; Fri, 13 Nov 2015 09:02:10 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51381) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZxEvW-0004Ja-S3 for bug-guile@gnu.org; Fri, 13 Nov 2015 09:02:10 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZxEvS-00050N-3g for bug-guile@gnu.org; Fri, 13 Nov 2015 09:02:06 -0500 Received: from river6.fysh.org ([2001:41d0:d:20da::2]:37094 helo=river.fysh.org) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZxEvR-00050F-TX for bug-guile@gnu.org; Fri, 13 Nov 2015 09:02:02 -0500 Received: from zefram by river.fysh.org with local (Exim 4.80 #2 (Debian)) id 1ZxEvN-0000ar-U6; Fri, 13 Nov 2015 14:01:57 +0000 Date: Fri, 13 Nov 2015 14:01:57 +0000 From: Zefram To: bug-guile@gnu.org Subject: date->string duff ISO 8601 negative years Message-ID: <20151113140157.GN13455@fysh.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.0 (----) The date->string function from (srfi srfi-19), used on ISO 8601 formats "~1", "~4" and "~5", for years preceding AD 1, has an off-by-one error: scheme@(guile-user)> (use-modules (srfi srfi-19)) scheme@(guile-user)> (date->string (julian-day->date 0 0) "~4") $1 = "-4714-11-24T12:00:00Z" The date in question, the JD epoch, is 24 November 4714 BC (in the proleptic Gregorian calendar). In ISO 8601 format, that year is properly represented as "-4713", not "-4714", because ISO 8601 uses the AD era exclusively. 4714 BC = AD -4713. -zefram From debbugs-submit-bounces@debbugs.gnu.org Wed Apr 19 20:09:14 2017 Received: (at 21903) by debbugs.gnu.org; 20 Apr 2017 00:09:14 +0000 Received: from localhost ([127.0.0.1]:57651 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d0zes-0002kB-7M for submit@debbugs.gnu.org; Wed, 19 Apr 2017 20:09:14 -0400 Received: from river.fysh.org ([87.98.248.19]:33009 ident=Debian-exim) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d0zer-0002k3-71 for 21903@debbugs.gnu.org; Wed, 19 Apr 2017 20:09:13 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=fysh.org; s=20170316; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject:To:From:Date; bh=bRLD9oOGZ2gTymXFEBO6pYzEn31N3/r26S20Kr9xgNo=; b=qPBEyT1II5WCfBEVItDtDLfRKdfGaZXONlJgB20nd7aEH39QVqYw8m6cFP6V3Bc0iWNd77LxbqsxF2BoL7MuvsG10kbMPha7XaAofKqRp2/EHyNjv1dErB1HwsKZhPxsepMmShGINrL4j5UFkOz+AzSO9Ulg6udhpCtuCr9ptcQ=; Received: from zefram by river.fysh.org with local (Exim 4.84_2 #1 (Debian)) id 1d0zep-0005wD-2O; Thu, 20 Apr 2017 01:09:11 +0100 Date: Thu, 20 Apr 2017 01:09:11 +0100 From: Zefram To: 21903@debbugs.gnu.org Subject: Re: bug#21903: date->string duff ISO 8601 negative years Message-ID: <20170420000911.GE912@fysh.org> References: <20151113140157.GN13455@fysh.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="Q0rSlbzrZN6k9QnT" Content-Disposition: inline In-Reply-To: <20151113140157.GN13455@fysh.org> X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 21903 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) --Q0rSlbzrZN6k9QnT Content-Type: text/plain; charset=us-ascii Content-Disposition: inline A patch to fix this is attached. It applies on top of my patch for bug#21904. The choice that I described for that bug about whether to change ~Y or to have a separate ISO 8601 year formatter actually applies to both bugs, and the comment that I made there about exposing the non-linear year numbering is really only about this bug. -zefram --Q0rSlbzrZN6k9QnT Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="0002-fix-SRFI-19-s-ISO-8601-year-numbering.patch" >From 3d39f1dfa0e210282db48a9af828646d7e9acef3 Mon Sep 17 00:00:00 2001 From: Zefram Date: Thu, 20 Apr 2017 00:53:40 +0100 Subject: [PATCH 2/2] fix SRFI-19's ISO 8601 year numbering The ISO 8601 date formats offered by SRFI-19's date->string function were emitting incorrect year numbers for years preceding AD 1. It was following the non-linear numbering that the library uses in the date structure, rather than the standard astronomical year numbering required by ISO 8601. This is now fixed. As with the preceding fix for the syntax of year numbers, the fix is actually applied to the ~Y format, which SRFI-19 doesn't require to follow ISO 8601. --- module/srfi/srfi-19.scm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/module/srfi/srfi-19.scm b/module/srfi/srfi-19.scm index d4308bb..0e56c31 100644 --- a/module/srfi/srfi-19.scm +++ b/module/srfi/srfi-19.scm @@ -1128,7 +1128,8 @@ 2) port))) (cons #\Y (lambda (date pad-with port) - (let ((y (date-year date))) + (let* ((yy (date-year date)) + (y (if (negative? yy) (+ yy 1) yy))) (cond ((negative? y) (display #\- port)) ((>= y 10000) (display #\+ port))) (display (padding (abs y) #\0 4) port)))) -- 2.1.4 --Q0rSlbzrZN6k9QnT-- From debbugs-submit-bounces@debbugs.gnu.org Sat Oct 20 18:33:50 2018 Received: (at 21903) by debbugs.gnu.org; 20 Oct 2018 22:33:50 +0000 Received: from localhost ([127.0.0.1]:33573 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gDzoc-0001hr-5A for submit@debbugs.gnu.org; Sat, 20 Oct 2018 18:33:50 -0400 Received: from world.peace.net ([64.112.178.59]:35552) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gDzob-0001hf-8t for 21903@debbugs.gnu.org; Sat, 20 Oct 2018 18:33:49 -0400 Received: from mhw by world.peace.net with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1gDzoV-0000As-Ab; Sat, 20 Oct 2018 18:33:43 -0400 From: Mark H Weaver To: Zefram Subject: Re: bug#21903: date->string duff ISO 8601 negative years References: <20151113140157.GN13455@fysh.org> Date: Sat, 20 Oct 2018 18:33:31 -0400 In-Reply-To: <20151113140157.GN13455@fysh.org> (Zefram's message of "Fri, 13 Nov 2015 14:01:57 +0000") Message-ID: <87lg6s2qpw.fsf@netris.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 21903 Cc: 21903@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Zefram writes: > The date->string function from (srfi srfi-19), used on ISO 8601 formats > "~1", "~4" and "~5", for years preceding AD 1, has an off-by-one error: > > scheme@(guile-user)> (use-modules (srfi srfi-19)) > scheme@(guile-user)> (date->string (julian-day->date 0 0) "~4") > $1 = "-4714-11-24T12:00:00Z" > > The date in question, the JD epoch, is 24 November 4714 BC (in the > proleptic Gregorian calendar). In ISO 8601 format, that year is properly > represented as "-4713", not "-4714", because ISO 8601 uses the AD era > exclusively. 4714 BC = AD -4713. I agree that this is definitely a bug, but I'm nervous about deviating from the SRFI-19 reference implementation, and therefore probably from most other implementations of SRFI-19, in this way. I think that this bug should be reported to the SRFI-19 mailing list. https://srfi.schemers.org/srfi-19/ There have been several other bugs reported and fixed in upstream SRFI-19 over the years, including some as recently as June 2017, so I'm hopeful that they will take this bug seriously and issue a fix. Would you like to report it to them? Mark From debbugs-submit-bounces@debbugs.gnu.org Sat Oct 20 20:40:47 2018 Received: (at 21903) by debbugs.gnu.org; 21 Oct 2018 00:40:47 +0000 Received: from localhost ([127.0.0.1]:33652 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gE1nS-0000Jj-Tq for submit@debbugs.gnu.org; Sat, 20 Oct 2018 20:40:47 -0400 Received: from world.peace.net ([64.112.178.59]:41742) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gE1nQ-0000JW-Q6 for 21903@debbugs.gnu.org; Sat, 20 Oct 2018 20:40:45 -0400 Received: from mhw by world.peace.net with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1gE1nK-0001mE-V4; Sat, 20 Oct 2018 20:40:39 -0400 From: Mark H Weaver To: Zefram Subject: Re: bug#21903: date->string duff ISO 8601 negative years References: <20151113140157.GN13455@fysh.org> <87lg6s2qpw.fsf@netris.org> Date: Sat, 20 Oct 2018 20:40:26 -0400 In-Reply-To: <87lg6s2qpw.fsf@netris.org> (Mark H. Weaver's message of "Sat, 20 Oct 2018 18:33:31 -0400") Message-ID: <87sh10169x.fsf@netris.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 21903 Cc: 21903@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Mark H Weaver writes: > Zefram writes: > >> The date->string function from (srfi srfi-19), used on ISO 8601 formats >> "~1", "~4" and "~5", for years preceding AD 1, has an off-by-one error: >> >> scheme@(guile-user)> (use-modules (srfi srfi-19)) >> scheme@(guile-user)> (date->string (julian-day->date 0 0) "~4") >> $1 = "-4714-11-24T12:00:00Z" >> >> The date in question, the JD epoch, is 24 November 4714 BC (in the >> proleptic Gregorian calendar). In ISO 8601 format, that year is properly >> represented as "-4713", not "-4714", because ISO 8601 uses the AD era >> exclusively. 4714 BC = AD -4713. > > I agree that this is definitely a bug, but I'm nervous about deviating > from the SRFI-19 reference implementation, and therefore probably from > most other implementations of SRFI-19, in this way. Also see my comments here: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=21904#17 which mention that ISO 8601 apparently requires that the sender and receiver agree ahead of time whether an extended format will be used, in which case a sign is *always* required, even when printing years in the range 0-9999. Mark From debbugs-submit-bounces@debbugs.gnu.org Sun Oct 21 00:02:21 2018 Received: (at 21903-done) by debbugs.gnu.org; 21 Oct 2018 04:02:21 +0000 Received: from localhost ([127.0.0.1]:33711 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gE4wW-000521-Uc for submit@debbugs.gnu.org; Sun, 21 Oct 2018 00:02:21 -0400 Received: from world.peace.net ([64.112.178.59]:48820) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gE4wU-00051o-8E for 21903-done@debbugs.gnu.org; Sun, 21 Oct 2018 00:02:18 -0400 Received: from mhw by world.peace.net with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1gE4wO-0003lG-Dv; Sun, 21 Oct 2018 00:02:12 -0400 From: Mark H Weaver To: Zefram Subject: Re: bug#21903: date->string duff ISO 8601 negative years References: <20151113140157.GN13455@fysh.org> <87lg6s2qpw.fsf@netris.org> <87sh10169x.fsf@netris.org> Date: Sun, 21 Oct 2018 00:01:59 -0400 In-Reply-To: <87sh10169x.fsf@netris.org> (Mark H. Weaver's message of "Sat, 20 Oct 2018 20:40:26 -0400") Message-ID: <87a7n80wy0.fsf@netris.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 21903-done Cc: 21903-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Mark H Weaver writes: > Mark H Weaver writes: > >> Zefram writes: >> >>> The date->string function from (srfi srfi-19), used on ISO 8601 formats >>> "~1", "~4" and "~5", for years preceding AD 1, has an off-by-one error: >>> >>> scheme@(guile-user)> (use-modules (srfi srfi-19)) >>> scheme@(guile-user)> (date->string (julian-day->date 0 0) "~4") >>> $1 = "-4714-11-24T12:00:00Z" >>> >>> The date in question, the JD epoch, is 24 November 4714 BC (in the >>> proleptic Gregorian calendar). In ISO 8601 format, that year is properly >>> represented as "-4713", not "-4714", because ISO 8601 uses the AD era >>> exclusively. 4714 BC = AD -4713. >> >> I agree that this is definitely a bug, but I'm nervous about deviating >> from the SRFI-19 reference implementation, and therefore probably from >> most other implementations of SRFI-19, in this way. > > Also see my comments here: > > https://debbugs.gnu.org/cgi/bugreport.cgi?bug=21904#17 > > which mention that ISO 8601 apparently requires that the sender and > receiver agree ahead of time whether an extended format will be used, in > which case a sign is *always* required, even when printing years in the > range 0-9999. Since writing this, I've discovered that the SRFI-19 reference implementation's formatting of negative years is very badly broken. For example, when the year is -2, it prints "00-2". Guile's behavior was similarly broken for a short time, after I applied upstream fixes. Since the current behavior of SRFI-19 and Guile is so clearly broken in the case of negative years, I'm no longer concerned with maintaining compatibility with SRFI-19 here. I also feel more urgency to apply a fix. So, I went ahead and implemented your recommended behavior, in commit a58c7abd72648f77e4ede5f62a2c4e7969bb7f95 on the stable-2.2 branch. I'm closing this bug now, but please reopen if appropriate. Thanks, Mark From unknown Sun Jun 15 08:45:04 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Sun, 18 Nov 2018 12:24:05 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator