Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 3 Jan 2000 21:54:28 -0500 (EST)
From:      "Crist J. Clark" <cjc@cc942873-a.ewndsr1.nj.home.com>
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   bin/15872: Y2k bug in at(1)
Message-ID:  <200001040254.VAA11470@cc942873-a.ewndsr1.nj.home.com>

next in thread | raw e-mail | index | archive | help

>Number:         15872
>Category:       bin
>Synopsis:       Y2k bug in at(1)
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Jan  3 19:00:01 PST 2000
>Closed-Date:
>Last-Modified:
>Originator:     Crist J. Clark
>Release:        FreeBSD 3.4-STABLE i386
>Organization:
>Environment:

	Present in all FreeBSD versions checked (2.x.x and 3.x). Also
seen in other BSDs.

>Description:

	There is a Y2k bug in at(1). The following portion of code
can cause valid time specifications to return 'garbled time' errors,

/*
 * assign_date() assigns a date, wrapping to next year if needed
 */
static void
assign_date(struct tm *tm, long mday, long mon, long year)
{
    if (year > 99) {
	if (year > 1899)
	    year -= 1900;
	else
	    panic("garbled time");
    } ...

When this function is passed the current year in tm_year format, 100,
it will complain it is a garbled time. However, it is a legal value.

>How-To-Repeat:

	Try to queue an atjob in the following manner,

% at 10:30am wed
at: garbled time

However, that is a legal command line.

>Fix:
	
	The parsetime.c code, which is excerpted above, is a _very_
complex piece of work. I hesitate to write a patch to fix this small
problem since it might create greater ones. I leave it to someone with
more familiarity with the code. (However, I am not sure why the 
'year > 99' check is needed at all.)

	In the mean time, the previous command line can will work if
you phrase it,

% at 10:30 + 2 days

You may need to try other convoluted constructions to work around
other formats that might trigger the bug.

>Release-Note:
>Audit-Trail:
>Unformatted:


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200001040254.VAA11470>