GNU bug report logs - #55401
date man page

Previous Next

Package: coreutils;

Reported by: t0th <south.minds <at> gmail.com>

Date: Fri, 13 May 2022 19:29:02 UTC

Severity: normal

To reply to this bug, email your comments to 55401 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-coreutils <at> gnu.org:
bug#55401; Package coreutils. (Fri, 13 May 2022 19:29:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to t0th <south.minds <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-coreutils <at> gnu.org. (Fri, 13 May 2022 19:29:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: t0th <south.minds <at> gmail.com>
To: bug-coreutils <at> gnu.org
Subject: date man page
Date: Fri, 13 May 2022 16:10:44 -0300
[Message part 1 (text/plain, inline)]
Man page of date command should make explicit that -d and -r options are
mutually exclusive.

date -d -3 minutes -r tmp.txt "+%Y%m%d_%H%M"
date: the options to specify dates for printing are mutually exclusive
[Message part 2 (text/html, inline)]

Information forwarded to bug-coreutils <at> gnu.org:
bug#55401; Package coreutils. (Sat, 14 May 2022 00:43:02 GMT) Full text and rfc822 format available.

Message #8 received at 55401 <at> debbugs.gnu.org (full text, mbox):

From: Pádraig Brady <P <at> draigBrady.com>
To: t0th <south.minds <at> gmail.com>, 55401 <at> debbugs.gnu.org
Subject: Re: bug#55401: date man page
Date: Sat, 14 May 2022 01:42:37 +0100
[Message part 1 (text/plain, inline)]
On 13/05/2022 20:10, t0th wrote:
> Man page of date command should make explicit that -d and -r options are
> mutually exclusive.

Right.  More accurately, we might have a sentence to say that:
"All options to specify the date to display are mutually exclusive.
I.e.: --date, --file, --reference, --resolution".
However...

> date -d -3 minutes -r tmp.txt "+%Y%m%d_%H%M"
> date: the options to specify dates for printing are mutually exclusive

As you've seen, one might expect to be able to combine, as -d can be relative.
So theoretically we could support this (with the attached),
to honor the relative adjustment, but give precedence to a non relative date.

  $ src/date -r src/ls.c -d '-3 minutes'
  Fri 15 Apr 2022 16:30:53 IST
  $ src/date -r src/ls.c -d '1/1/2022'
  Sat 01 Jan 2022 00:00:00 GMT

In fact touch(1) behaves like this, which suggests date(1) should also.
From the info docs for the touch --reference option:

 "--reference
  Use the times of the reference FILE instead of the current time.
  If this option is combined with the --date=TIME
  (-d TIME) option, the reference FILES's time is
  the origin for any relative TIMEs given, but is otherwise ignored."

BTW, one might also expect that multiple -d options might combine like this,
however currently we silently ignore multiple -d (or -s) options.
The attached also at least warns about this with --debug:

  $ date --debug -d '15/4/2022' -d '-3 minutes'
  date: discarding previous -d: ‘15/4/2022’
  date: parsed relative part: -3 minutes
  ...

cheers,
Pádraig
[date-d-r.patch (text/x-patch, attachment)]

Information forwarded to bug-coreutils <at> gnu.org:
bug#55401; Package coreutils. (Sun, 24 Jul 2022 20:07:02 GMT) Full text and rfc822 format available.

Message #11 received at 55401 <at> debbugs.gnu.org (full text, mbox):

From: Pádraig Brady <P <at> draigBrady.com>
To: t0th <south.minds <at> gmail.com>, 55401 <at> debbugs.gnu.org
Subject: Re: bug#55401: date man page
Date: Sun, 24 Jul 2022 21:06:34 +0100
[Message part 1 (text/plain, inline)]
On 14/05/2022 01:42, Pádraig Brady wrote:
> On 13/05/2022 20:10, t0th wrote:
>> Man page of date command should make explicit that -d and -r options are
>> mutually exclusive.
> 
> Right.  More accurately, we might have a sentence to say that:
> "All options to specify the date to display are mutually exclusive.
> I.e.: --date, --file, --reference, --resolution".

I've pushed the attached 2 patches
to document the current situation at least.

cheers,
Padraig
[date-exclusive-help.patch (text/x-patch, attachment)]
[date-multiple-debug.patch (text/x-patch, attachment)]

This bug report was last modified 2 years and 123 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.