[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: date bug (documentation bug?)
From: |
Eric Blake |
Subject: |
Re: date bug (documentation bug?) |
Date: |
Sat, 29 Apr 2006 16:12:51 -0600 |
User-agent: |
Thunderbird 1.5.0.2 (Windows/20060308) |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
According to stefano.sabatini-lala on 4/26/2006 10:25 AM:
> date doesn't work as expexcted after reading the man page.
>
> In order to set the date you need to do:
> $ date <date in some weird format>
>
> The command:
> $ date --set=<date in some weird format>
> doesn't appear to work.
Thanks for the report. Actually, date without arguments is the only use
of the weird format. When you use the --set option, you get the same date
parsing used by the --date option, which has an entire chapter devoted to
the various constructs parsed in the info manual (see 'info coreutils
date'). Unfortunately, the non-option format is so weird that --date (and
thus --set) do not reliably parse it; it looks too ambiguous and lacks
context to make it obvious what underlying format was intended.
>
> For example look at this session:
> address@hidden:~$ LANGUAGE=en_US sudo date 0426172006
> Qua Abr 26 17:20:00 WEST 2006
> address@hidden:~$ LANGUAGE=en_US sudo date --set=0426172006
> date: invalid date `0426172006'
> address@hidden:~$ LANGUAGE=en_US sudo date --set="0426172006"
> date: invalid date `0426172006'
>
> The first command syntax (the only that actually work) isn't
> documented in the man page.
Actually it is. The date man page is auto-generated from 'date --help'
output, and as of the latest stable release of coreutils, 5.94, both
contain the synopsis of "date [-u|--utc|--universal] [MMDDhhmm[[CC]YY][.ss]]"
Try instead doing:
LANGUAGE=en_US sudo date --set='Qua Abr 26 17:20:00 WEST 2006'
If you then have a problem, then you have uncovered a bug in date; we
desire that we can unambiguously parse any output that date produces when
no format string was supplied.
> It's quite puzzling!
If you have any suggestions how the documentation could be made clearer,
or think you can patch the date parser to accept the weird format of date
as a valid argument to --date/--set, we would love to hear your ideas.
- --
Life is short - so eat dessert first!
Eric Blake address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.1 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFEU+Tj84KuGfSFAYARAqIeAJwMVeuBLNlW5559k5X1F2I5W9Tf2gCfTkQT
p1OgH9szfidM+06fyfe6dVY=
=Yrfi
-----END PGP SIGNATURE-----