From cr@jcmax.com  Thu Mar 30 22:02:56 2000
Return-Path: <cr@jcmax.com>
Received: from vortex.jcmax.com (vortex.jcmax.com [204.69.248.1])
	by hub.freebsd.org (Postfix) with ESMTP id 7791F37B6A1
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 30 Mar 2000 22:02:55 -0800 (PST)
	(envelope-from cr@jcmax.com)
Received: from plasma.jcmax.com (plasma.jcmax.com [204.69.248.13])
	by vortex.jcmax.com (8.9.3/8.9.3) with ESMTP id BAA03898
	for <FreeBSD-gnats-submit@freebsd.org>; Fri, 31 Mar 2000 01:02:53 -0500 (EST)
	(envelope-from cr@jcmax.com)
Received: (from cr@localhost)
	by plasma.jcmax.com (8.9.3/8.9.3) id BAA48184;
	Fri, 31 Mar 2000 01:02:53 -0500 (EST)
	(envelope-from cr@jcmax.com)
Message-Id: <200003310602.BAA48184@plasma.jcmax.com>
Date: Fri, 31 Mar 2000 01:02:53 -0500 (EST)
From: Cyrus Rahman <cr@jcmax.com>
Reply-To: cr@jcmax.com
To: FreeBSD-gnats-submit@freebsd.org
Subject: at(1) is not y2k compliant
X-Send-Pr-Version: 3.2

>Number:         17704
>Category:       bin
>Synopsis:       at(1) is not y2k compliant
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Mar 30 22:10:01 PST 2000
>Closed-Date:    Fri Mar 31 01:09:27 PST 2000
>Last-Modified:  Fri Mar 31 01:11:17 PST 2000
>Originator:     Cyrus Rahman
>Release:        FreeBSD 4.0-STABLE i386
>Organization:
>Environment:


>Description:

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().

>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

>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:

*** parsetime.c.old	Thu Mar 30 22:29:14 2000
--- parsetime.c	Thu Mar 30 22:24:19 2000
***************
*** 495,501 ****
  
  	    tm->tm_wday = wday;
  
! 	    assign_date(tm, mday, tm->tm_mon, tm->tm_year);
  	    break;
  
      case NUMBER:
--- 495,501 ----
  
  	    tm->tm_wday = wday;
  
! 	    assign_date(tm, mday, tm->tm_mon, tm->tm_year + 1900);
  	    break;
  
      case NUMBER:

>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: sheldonh 
State-Changed-When: Fri Mar 31 01:09:27 PST 2000 
State-Changed-Why:  
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. 
>Unformatted:
