Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 3 Jan 2000 21:42:15 -0500 (EST)
From:      "Crist J. Clark" <cjc@cc942873-a.ewndsr1.nj.home.com>
To:        Alan.Evans@netouch.com (Alan Evans)
Cc:        freebsd-questions@FreeBSD.ORG
Subject:   Re: "at 1:30am monday" gives "at: garbled time" after y2k rollover
Message-ID:  <200001040242.VAA11342@cc942873-a.ewndsr1.nj.home.com>
In-Reply-To: <200001032124.NAA12544@r2d2.netouch.net> from Alan Evans at "Jan 3, 2000 01:24:46 pm"

next in thread | previous in thread | raw e-mail | index | archive | help
Alan Evans wrote,
> 
> I have several boxes with various versions of FreeBSD
> (2.1, 2.1.6, 2.2.[2678], 3.2) and they all appear to have the
> same problem with the "at" command.
> 
> We have our weekly.local script on a 2.2.6 box schedule a
> job to run on Monday morning at 1:30am. The scheduling happens
> at the predictable time on Saturday mornings when /etc/weekly runs.
> The scheduling command looks like this:
> 
> at 1:30am Monday <<EOF
> /www/bin/process_logfiles.sh
> EOF
> 
> 
> Up until this past weekend, this had been working fine (4+ years).
> Starting Saturday morning (1/1/2000), this particular feature of at
> (using day of week) gives back "at: garbled time". The workaround
> has been to change the example above to:
> 
> at 1:30am +2 days <<EOF
> /www/bin/process_logfiles.sh
> EOF
> 
> 
> I tested out OpenBSD 2.6 as well and the bug appears there as well.
> 
> FYI,

Cool! A bona fide Y2k bug no one had caught!

From /usr/src/at/parsetime.c,


/*
 * 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");
    } ...

Since 'year' is the value of tm_year in a tm structure, the current
value is 100. This registers as a "garbled time." That's actually
quite funny since further down in this function there are specific
mentions of making the function work for >2000.

I don't see a PR for this. Sending one. I'd write a patch, but it
would take me a long time to figure out just how many ways 'year' is
used in this program.
-- 
Crist J. Clark                           cjclark@home.com


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




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