Subject: bug#24077: VS: bug in MAN page for data command

From: Pádraig Brady <[email-masked]>
Date: Wed, 27 Jul 2016 10:13:42 +0100

On 27/07/16 09:20, Bernhard Voelker wrote:
> On 07/27/2016 09:07 AM, Paul Eggert wrote:
>> On 07/26/2016 09:13 AM, Lars Issing Sauer wrote:
>>>   According to the description "%M" is minutes and "%m" is month... but
>>>   the command takes "%M" as month and "%m" as minutes ;)
>>
>> Sorry, I don't see any bug here. "date +%M" outputs the current number of minutes
>> past the hour, and "date +%m" outputs the current month number, and that is what is documented.
> 
> Hi Paul,
> 
> I think it's regarding the MM vs. mm in the usage string:
> 
>   $ src/date --help | grep MM
>     or:  src/date [-u|--utc|--universal] [MMDDhhmm[[CC]YY][.ss]]
> __________________________________________^^____^^
> 
>   $ src/date -u 072710132016
>   src/date: cannot set date: Operation not permitted
>   Wed Jul 27 10:13:00 UTC 2016
> 
> The MM/mm here is inconsistent compared to the %M/%m modifiers.
> 
> Usage | % mod | meaning
> ------+-------+--------
>  MM   | %m    | month
>  mm   | %M    | minute
> 
> Do you agree?

Yes it's more consistent to match this input representation
with the output +FORMATs.  I.E. use: [mmddHHMM[[CC]yy][.SS]]
It's more natural to use uppercase for larger quantities,
but being consistent with +FORMAT trumps that IMHO.

Fixed in the attached.

thanks
Pádraig
>From fcc32d0fc4450169f0654980e4c536ce47dd159e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?P=C3=A1draig=20Brady?= <[email-masked]>
Date: Wed, 27 Jul 2016 10:05:20 +0100
Subject: [PATCH] doc: make date(1) synopsis consistent with output +FORMAT

* src/date.c (usage): Make the characters used to summarize
the input format, match the output +FORMAT characters.
* doc/coreutils.texi (date invocation): Likewise.
Fixes http://bugs.gnu.org/24077
---
 doc/coreutils.texi | 2 +-
 src/date.c         | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/doc/coreutils.texi b/doc/coreutils.texi
index 914aec7..b85404b 100644
--- a/doc/coreutils.texi
+++ b/doc/coreutils.texi
@@ -15018,7 +15018,7 @@ Synopses:
 @example
 date [@var{option}]@dots{} [+@var{format}]
 date [-u|--utc|--universal] @c this avoids a newline in the output
-[ MMDDhhmm[[CC]YY][.ss] ]
+[ mmddHHMM[[CC]yy][.SS] ]
 @end example
 
 @vindex LC_TIME
diff --git a/src/date.c b/src/date.c
index e73196b..a9a580c 100644
--- a/src/date.c
+++ b/src/date.c
@@ -122,7 +122,7 @@ usage (int status)
     {
       printf (_("\
 Usage: %s [OPTION]... [+FORMAT]\n\
-  or:  %s [-u|--utc|--universal] [MMDDhhmm[[CC]YY][.ss]]\n\
+  or:  %s [-u|--utc|--universal] [mmddHHMM[[CC]yy][.SS]]\n\
 "),
               program_name, program_name);
       fputs (_("\
-- 
2.5.5