Bug 17704

Summary: at(1) is not y2k compliant
Product: Base System Reporter: Cyrus Rahman <cr>
Component: binAssignee: freebsd-bugs (Nobody) <bugs>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: 4.0-STABLE   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
file.diff none

Description Cyrus Rahman 2000-03-31 07:10:01 UTC
At(1) uses the following code in assign_date() to convert three possible year
formats to the format used by a tm structure:

    if (year > 99) {
	if (year > 1899)
	    year -= 1900;
	else
	    panic("garbled time");
    }

If year contains:

	the last two digits of the current year,
	or the actual value of the year,

all is well.  However, if year contains:

	the tm_year value of a year after the year 1999 (e.g. 100)

the code calls panic().

Fix: Instead of passing three different year formats into assign_date() and hoping
it figures out what to do with them, convert the year to the actual value
first in the one place where this is not done:
How-To-Repeat: 
Try using dates specifying a weekday, for which the parser passes a tm_year
to assign_date():

	sh> at 01:15 Sunday
	at: garbled time
Comment 1 Sheldon Hearn freebsd_committer freebsd_triage 2000-03-31 10:09:27 UTC
State Changed
From-To: open->closed

This is a duplicate of PR 15872.  A different fix has been committed 
in 5.0-CURRENT and will be merged onto the stable branches later, 
as is standard practise with non-critical bugfixes.