Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 31 Mar 2000 01:02:53 -0500 (EST)
From:      Cyrus Rahman <cr@jcmax.com>
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   bin/17704: at(1) is not y2k compliant
Message-ID:  <200003310602.BAA48184@plasma.jcmax.com>

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

>Number:         17704
>Category:       bin
>Synopsis:       at(1) is not y2k compliant
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Mar 30 22:10:01 PST 2000
>Closed-Date:
>Last-Modified:
>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:
>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?200003310602.BAA48184>