Subject: Re: bin/28450: date(1) does not validate its input and accepts and processes
To: David H.Gutteridge <dhgutteridge@sympatico.ca>
From: Robert Elz <kre@munnari.OZ.AU>
List: netbsd-bugs
Date: 12/07/2004 13:42:26
    Date:        Tue, 7 Dec 2004 0:23:47 -0500
    From:        "David H.Gutteridge" <dhgutteridge@sympatico.ca>
    Message-ID:  <20041207052348.QYRY1814.tomts9-srv.bellnexxia.net@mxmta.bellnexxia.net>

  | fsdb(8) [...] and that mktime() likes what it receives (which as we
  | know from date(1) isn't a thorough arbiter of correct understanding
  | of human intention).

mktime() is explicitly not intended to require its input be a "rational"
human type representation of a time.    That's to allow

	tm = localtime(t);
	tm->tm_mon++;
	t = mktime(tm);

type things, without having to check that the incremented month (or
any other field) remains in bounds - mktime compensates.

The effect of this, of course, is that mktime() is useless as a date/time
string input validator.

It sounds from your research as if there should be one, perhaps in libutil
or something, that everyone else can use.   I guess the tricky bit is
making it correctly handle the various formats (required inputs) of the
different programs.

kre