Hello, (adding bug-gnulib again :) )
Thank you both for the review and suggestions. On 2019-08-10 1:46 a.m., Paul Eggert wrote: > Assaf Gordon wrote: >> I suggest the attached patch for coreutils. > > OK, except I'd remove "in accordance with rfc5322" since RFC 5322 > recommends treating all these zones as if they were UTC. Also, "T" > continues to have its military meaning (i.e., between "S" and "U") if > it's used properly. Good point about 'T'. After adding an additional test for it, I realized the gnulib fix wasn't complete because it didn't negate the 'T' value from UTC+7 to UTC-7. Attached suggested follow-up patch for gnulib. On Sat, Aug 10, 2019 at 05:40:30PM +0200, Bernhard Voelker wrote: > On 8/10/19 4:26 AM, Assaf Gordon wrote: > > This results in a user-visible change for gnu date, > > I suggest the attached patch for coreutils. > > The gnulib update requires the attached to calm down sc_po_check. > You may squash that into your gnulib update commit (or leave it separate). Good catch. The attached patch-set includes this fix, and the updated NEWS wording. (I'll wait until gnulib is updated with the additional fix, then create a new coreutil patch with the latest gnulib.) regards, - assaf
>From 9f464d51d8311f33340942c76e758454fa59042d Mon Sep 17 00:00:00 2001 From: Assaf Gordon <assafgor...@gmail.com> Date: Sat, 10 Aug 2019 13:17:49 -0600 Subject: [PATCH] parse-datetime: fix 'T' military timezone handling follow-up to the previous commit: the 'T' case is handled outside the conversion table (used as either military timezone UTC-7 or ISO8601 separator). Change it from "HOUR(7)" to "-HOUR(7)" to match other timezone letters. * lib/parse-datetime.y: Change 'T' value from UTC+7 yo UTC-7. * ChangeLog: Mention the change. --- ChangeLog | 8 ++++++++ lib/parse-datetime.y | 4 ++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7616b5efd..7c25c53e5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2019-08-10 Assaf Gordon <assafgor...@gmail.com> + + parse-datetime: fix 'T' military timezone handling + follow-up to the previous commit: the 'T' case is handled outside the + conversion table (used as either military timezone UTC-7 or ISO8601 + separator). Change it from "HOUR(7)" to "-HOUR(7)" to match other + timezone letters. + 2019-08-09 Paul Eggert <egg...@cs.ucla.edu> parse-datetime: fix military timezone letters diff --git a/lib/parse-datetime.y b/lib/parse-datetime.y index d371b9cb1..218e3dc5b 100644 --- a/lib/parse-datetime.y +++ b/lib/parse-datetime.y @@ -754,14 +754,14 @@ zone: tZONE { pc->time_zone = $1; } | 'T' - { pc->time_zone = HOUR (7); } + { pc->time_zone = -HOUR (7); } | tZONE relunit_snumber { pc->time_zone = $1; if (! apply_relative_time (pc, $2, 1)) YYABORT; debug_print_relative_time (_("relative"), pc); } | 'T' relunit_snumber - { pc->time_zone = HOUR (7); + { pc->time_zone = -HOUR (7); if (! apply_relative_time (pc, $2, 1)) YYABORT; debug_print_relative_time (_("relative"), pc); } -- 2.20.1
>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/3] 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 673a0360b9dd96cfe0df017febb40980843cbb84 Mon Sep 17 00:00:00 2001 From: Bernhard Voelker <m...@bernhard-voelker.de> Date: Mon, 22 Jul 2019 08:53:28 +0200 Subject: [PATCH 2/3] maint: add lib/argmatch.h to po/POTFILES.in * po/POTFILES.in (lib/argmatch.h): Add to avoid sc_po_check error: "maint.mk: you have changed the set of files with translatable \ diagnostics;" --- po/POTFILES.in | 1 + 1 file changed, 1 insertion(+) diff --git a/po/POTFILES.in b/po/POTFILES.in index 60c5124ac..4231f56c4 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -3,6 +3,7 @@ # These are nominally temporary... lib/argmatch.c +lib/argmatch.h lib/closein.c lib/closeout.c lib/copy-acl.c -- 2.20.1 >From 0c552fac1991f49ef2db347adaed7bd82b935d70 Mon Sep 17 00:00:00 2001 From: Assaf Gordon <assafgor...@gmail.com> Date: Fri, 9 Aug 2019 20:16:06 -0600 Subject: [PATCH 3/3] 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 | 13 +++++++++++++ tests/misc/date.pl | 10 ++++++++++ 2 files changed, 23 insertions(+) diff --git a/NEWS b/NEWS index 97c9d18bd..6719e504d 100644 --- a/NEWS +++ b/NEWS @@ -49,6 +49,19 @@ 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 common usage: + "A" to "M" are equivalent to UTC+1 to UTC+12 + "N" to "Y" are equivalent to UTC-1 to UTC-12 + "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..92755b1f2 100755 --- a/tests/misc/date.pl +++ b/tests/misc/date.pl @@ -300,6 +300,16 @@ 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:00T" +%T', {OUT => '16:00:00'}], + ['mtz5', '-u -d "09:00X" +%T', {OUT => '20:00:00'}], + ['mtz6', '-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