Hello,

On Fri, Aug 09, 2019 at 02:01:35PM -0700, Paul Eggert wrote:
> Since the RFC 822 error was fixed in 2001 when RFC 2822 came out, it is long
> past time to fix parse-datetime.y accordingly, so I installed the attached
> patch into Gnulib.

This results in a user-visible change for gnu date,
I suggest the attached patch for coreutils.

-assaf
>From 19f7eab06af234641a2927514c03570c07a311db Mon Sep 17 00:00:00 2001
From: Assaf Gordon <assafgor...@gmail.com>
Date: Fri, 9 Aug 2019 19:51:42 -0600
Subject: [PATCH 1/2] gnulib: update to latest

---
 gnulib | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gnulib b/gnulib
index c7d0b4506..f1f10d47b 160000
--- a/gnulib
+++ b/gnulib
@@ -1 +1 @@
-Subproject commit c7d0b4506574887be5835ae9ae892d365afbb98c
+Subproject commit f1f10d47be8762e4ca17c8957a0520b08d28abfb
-- 
2.20.1


>From 6eb1118f00a7018f08f69c7ace86cd92f89ca961 Mon Sep 17 00:00:00 2001
From: Assaf Gordon <assafgor...@gmail.com>
Date: Fri, 9 Aug 2019 20:16:06 -0600
Subject: [PATCH 2/2] date: mention military timezone changes from gnulib

Gnulib commit f1f10d47be8762e4ca17c8957a0520b08d28abfb (based on
https://lists.gnu.org/r/bug-gnulib/2019-08/msg00005.html) negated the
meaning of military timezones parsed in gnu date.

* NEWS: Mention this user-visible change.
* tests/misc/date.pl: Add tests for the new behavior.
---
 NEWS               | 16 ++++++++++++++++
 tests/misc/date.pl |  9 +++++++++
 2 files changed, 25 insertions(+)

diff --git a/NEWS b/NEWS
index 97c9d18bd..d4904d20b 100644
--- a/NEWS
+++ b/NEWS
@@ -49,6 +49,22 @@ GNU coreutils NEWS                                    -*- 
outline -*-
   coherency of file system attributes, useful on network file systems.
 
 
+** Changes in behavior
+
+  date now parses military time zones in accordance with rfc5322:
+    "A" to "M"  are equivalent to UTC+1 to UTC+12
+    "N" to "S"  are equivalent to UTC-1 to UTC-6
+    "U" to "Y"  are equivalent to UTC-8 to UTC-12
+    "T" is parsed as a ISO-8601 format representation,
+        and should not be used for military time zones in gnu date.
+    "Z" is "zulu" time (UTC).
+  For example, 'date -d "09:00B" is now equivalent to 9am in UTC+2 time zone.
+  Previously, military time zones were parsed according to the obsolete
+  rfc822, with their value negated (e.g., "B" was equivalent to UTC-2).
+  [The old behavior was introduced in sh-utils 2.0.15 ca. 1999, predating
+  coreutils package.]
+
+
 * Noteworthy changes in release 8.31 (2019-03-10) [stable]
 
 ** Bug fixes
diff --git a/tests/misc/date.pl b/tests/misc/date.pl
index 9ba3d3983..e11753347 100755
--- a/tests/misc/date.pl
+++ b/tests/misc/date.pl
@@ -300,6 +300,15 @@ my @Tests =
 
      # https://bugs.gnu.org/34608
      ['date-century-plus', '-d @0 +.%+4C.', {OUT => '.+019.'}],
+
+
+     # Military time zones, new behavior (since 8.32)
+     # https://lists.gnu.org/r/bug-gnulib/2019-08/msg00005.html
+     ['mtz1', '-u -d "09:00B" +%T', {OUT => '07:00:00'}],
+     ['mtz2', '-u -d "09:00L" +%T', {OUT => '22:00:00'}],
+     ['mtz3', '-u -d "09:00N" +%T', {OUT => '10:00:00'}],
+     ['mtz4', '-u -d "09:00X" +%T', {OUT => '20:00:00'}],
+     ['mtz5', '-u -d "09:00Z" +%T', {OUT => '09:00:00'}],
     );
 
 # Repeat the cross-dst test, using Jan 1, 2005 and every interval from 1..364.
-- 
2.20.1

Reply via email to