Debian Bug report logs - #729952
/bin/date: date parsing inconsistencies

version graph

Package: coreutils; Maintainer for coreutils is Michael Stone <[email protected]>; Source for coreutils is src:coreutils (PTS, buildd, popcon).

Reported by: "Ph. Marek" <[email protected]>

Date: Tue, 19 Nov 2013 10:21:01 UTC

Severity: minor

Found in version coreutils/8.21-1

Reply or subscribe to this bug.

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


Report forwarded to [email protected], [email protected], Michael Stone <[email protected]>:
Bug#729952; Package coreutils. (Tue, 19 Nov 2013 10:21:06 GMT) (full text, mbox, link).


Acknowledgement sent to "Ph. Marek" <[email protected]>:
New Bug report received and forwarded. Copy sent to [email protected], Michael Stone <[email protected]>. (Tue, 19 Nov 2013 10:21:06 GMT) (full text, mbox, link).


Message #5 received at [email protected] (full text, mbox, reply):

From: "Ph. Marek" <[email protected]>
To: Debian Bug Tracking System <[email protected]>
Subject: /bin/date: date parsing inconsistencies
Date: Tue, 19 Nov 2013 11:18:23 +0100
Package: coreutils
Version: 8.21-1
Severity: minor
File: /bin/date

These work as expected:

$ date -d '1 hour'
Die Nov 19 11:21:35 CET 2013
$ date -d '0 hour'
Die Nov 19 10:21:37 CET 2013
$ date -d '1 hour ago'
Die Nov 19 09:21:40 CET 2013


This gives a wrong answer, and no parsing error:
$ date -d 'a hour ago'
Die Nov 19 11:21:44 CET 2013

It looks like single characters are parsed as hour offsets:
$ date -d 'a'
Die Nov 19 02:00:00 CET 2013
$ date -d 'b'
Die Nov 19 03:00:00 CET 2013
$ date -d 'c'
$ date -d 'h'
Die Nov 19 09:00:00 CET 2013
$ date -d 'o'
Mon Nov 18 23:00:00 CET 2013
$ date -d 'p'
Mon Nov 18 22:00:00 CET 2013

I couldn't find anything about that in the info documentation.


This would be a bit more correct, but gives an error:
$ date -d 'an hour ago'
date: invalid date 'an hour ago'


$ echo $TZ
Europe/Vienna
$ locale
LANG=de_AT.UTF-8
LANGUAGE=de_AT:de
LC_CTYPE="de_AT.UTF-8"
LC_NUMERIC="de_AT.UTF-8"
LC_TIME="de_AT.UTF-8"
LC_COLLATE="de_AT.UTF-8"
LC_MONETARY="de_AT.UTF-8"
LC_MESSAGES="de_AT.UTF-8"
LC_PAPER="de_AT.UTF-8"
LC_NAME="de_AT.UTF-8"
LC_ADDRESS="de_AT.UTF-8"
LC_TELEPHONE="de_AT.UTF-8"
LC_MEASUREMENT="de_AT.UTF-8"
LC_IDENTIFICATION="de_AT.UTF-8"
LC_ALL=



-- System Information:
Debian Release: jessie/sid
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'unstable'), (500, 'stable'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 3.11-1-amd64 (SMP w/4 CPU cores)
Locale: LANG=de_AT.UTF-8, LC_CTYPE=de_AT.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages coreutils depends on:
ii  libacl1      2.2.52-1
ii  libattr1     1:2.4.47-1
ii  libc6        2.17-93
ii  libselinux1  2.1.13-3

coreutils recommends no packages.

coreutils suggests no packages.

-- no debconf information



Information forwarded to [email protected]:
Bug#729952; Package coreutils. (Thu, 21 Nov 2013 19:24:04 GMT) (full text, mbox, link).


Acknowledgement sent to Michael Stone <[email protected]>:
Extra info received and forwarded to list. (Thu, 21 Nov 2013 19:24:05 GMT) (full text, mbox, link).


Message #10 received at [email protected] (full text, mbox, reply):

From: Michael Stone <[email protected]>
To: "Ph. Marek" <[email protected]>, [email protected]
Subject: Re: Bug#729952: /bin/date: date parsing inconsistencies
Date: Thu, 21 Nov 2013 14:16:05 -0500
The date parsing feature exists in Debian only for compatibility with 
upstream. It is a complete misfeature, and I would prefer that it didn't 
exist at all. In an ideal world the entire idea of trying to utilize a
natural language parser would be scrapped in favor of a simple and 
regular grammar. Unfortunately, it is what it is. The only way to use 
the feature is to experiment until you find something that does what you 
want. The corollary to that is that nothing can be changed, because 
doing so would break existing scripts that were tweaked to perform 
correctly using the current implementation.

Mike Stone



Send a report that this bug log contains spam.


Debian bug tracking system administrator <[email protected]>. Last modified: Tue May 13 08:42:47 2025; Machine Name: bembo

Debian Bug tracking system

Debbugs is free software and licensed under the terms of the GNU General Public License version 2. The current version can be obtained from https://bugs.debian.org/debbugs-source/.

Copyright © 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson, 2005-2017 Don Armstrong, and many other contributors.