From sjr@zombie.ncsc.mil  Tue Jul  9 18:19:55 1996
Received: from who.cdrom.com (who.cdrom.com [204.216.27.3])
          by freefall.freebsd.org (8.7.5/8.7.3) with SMTP id SAA22966
          for <FreeBSD-gnats-submit@freebsd.org>; Tue, 9 Jul 1996 18:19:55 -0700 (PDT)
Received: from zombie.ncsc.mil (zombie.ncsc.mil [144.51.15.1])
          by who.cdrom.com (8.6.12/8.6.11) with ESMTP id SAA07407
          for <FreeBSD-gnats-submit@freebsd.org>; Tue, 9 Jul 1996 18:19:38 -0700
Received: (from sjr@localhost) by zombie.ncsc.mil (8.6.11/8.6.11) id VAA13250 for FreeBSD-gnats-submit@freebsd.org; Tue, 9 Jul 1996 21:18:02 -0400
Message-Id: <199607100118.VAA13250@zombie.ncsc.mil>
Date: Tue, 9 Jul 1996 21:18:02 -0400
From: "Stephen J. Roznowski" <sjr@zombie.ncsc.mil>
To: FreeBSD-gnats-submit@freebsd.org
Subject: Year 2000 breakage with tm_year

>Number:         1380
>Category:       misc
>Synopsis:       Year 2000 breakage with tm_year
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:
>Keywords:
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Jul  9 18:20:01 PDT 1996
>Closed-Date:    Sun Oct 20 10:57:32 PDT 1996
>Last-Modified:  Sun Oct 20 11:00:15 PDT 1996
>Originator:     Stephen J. Roznowski
>Release:        FreeBSD 2.2-960612-SNAP i386
>Organization:
>Environment:

>Description:

	Several programs have a hardcoded 19 in responses for the year.
	This will break in 4 years...

	This was fixed in NetBSD as PR misc/2308. (I think that I have
	the same changes as were finally committed)

>How-To-Repeat:

	find /usr/src -type f -print | xargs grep '19%'

>Fix:

	As I stated in the NetBSD PR: "There is also similiar code
	in "gnu/usr.bin/rcs/lib/rcstime.c", but I'm less sure of the
	proper fix there."


*** usr.bin/yacc/test/ftp.tab.c.orig	Tue Jul  9 16:57:53 1996
--- usr.bin/yacc/test/ftp.tab.c	Tue Jul  9 17:00:13 1996
***************
*** 1467,1474 ****
				struct tm *gmtime();
				t = gmtime(&stbuf.st_mtime);
				reply(213,
! 					    "19%02d%02d%02d%02d%02d%02d",
! 					    t->tm_year, t->tm_mon+1, t->tm_mday,
				    t->tm_hour, t->tm_min, t->tm_sec);
			}
		}
--- 1467,1474 ----
				struct tm *gmtime();
				t = gmtime(&stbuf.st_mtime);
				reply(213,
! 					    "%04d%02d%02d%02d%02d%02d",
! 					    1900+t->tm_year, t->tm_mon+1, t->tm_mday,
				    t->tm_hour, t->tm_min, t->tm_sec);
			}
		}
*** usr.bin/yacc/test/ftp.y.orig	Tue Jul  9 16:59:03 1996
--- usr.bin/yacc/test/ftp.y	Tue Jul  9 16:59:33 1996
***************
*** 455,462 ****
				struct tm *gmtime();
				t = gmtime(&stbuf.st_mtime);
				reply(213,
! 					    "19%02d%02d%02d%02d%02d%02d",
! 					    t->tm_year, t->tm_mon+1, t->tm_mday,
				    t->tm_hour, t->tm_min, t->tm_sec);
			}
		}
--- 455,462 ----
				struct tm *gmtime();
				t = gmtime(&stbuf.st_mtime);
				reply(213,
! 					    "%04d%02d%02d%02d%02d%02d",
! 					    1900+t->tm_year, t->tm_mon+1, t->tm_mday,
				    t->tm_hour, t->tm_min, t->tm_sec);
			}
		}
*** libexec/ftpd/ftpcmd.y.orig	Tue Jul  9 17:00:30 1996
--- libexec/ftpd/ftpcmd.y	Tue Jul  9 17:00:49 1996
***************
*** 491,498 ****
				struct tm *t;
				t = gmtime(&stbuf.st_mtime);
				reply(213,
! 					    "19%02d%02d%02d%02d%02d%02d",
! 					    t->tm_year, t->tm_mon+1, t->tm_mday,
				    t->tm_hour, t->tm_min, t->tm_sec);
			}
		}
--- 491,498 ----
				struct tm *t;
				t = gmtime(&stbuf.st_mtime);
				reply(213,
! 					    "%04d%02d%02d%02d%02d%02d",
! 					    1900+t->tm_year, t->tm_mon+1, t->tm_mday,
				    t->tm_hour, t->tm_min, t->tm_sec);
			}
		}
*** usr.bin/make/targ.c.orig	Tue Jul  9 17:01:00 1996
--- usr.bin/make/targ.c	Tue Jul  9 17:01:22 1996
***************
*** 467,475 ****

parts = localtime(&time);

!     sprintf (buf, "%d:%02d:%02d %s %d, 19%d",
     parts->tm_hour, parts->tm_min, parts->tm_sec,
! 	     months[parts->tm_mon], parts->tm_mday, parts->tm_year);
return(buf);
}

--- 467,475 ----

parts = localtime(&time);

!     sprintf (buf, "%d:%02d:%02d %s %d, %d",
     parts->tm_hour, parts->tm_min, parts->tm_sec,
! 	     months[parts->tm_mon], parts->tm_mday, 1900+parts->tm_year);
return(buf);
}
*** gnu/usr.sbin/isdn/load/load.c.orig	Tue Jul  9 17:18:28 1996
--- gnu/usr.sbin/isdn/load/load.c	Tue Jul  9 17:18:56 1996
***************
*** 71,78 ****
  
  	tt = time(NULL);
  	t = localtime(&tt);
! 	sprintf(buf, "%.2d%.2d%.2d%.2d%.2d19%.2d", t->tm_hour,
! 		t->tm_min, t->tm_sec, t->tm_mday, t->tm_mon + 1, t->tm_year);
  
  	if (ioctl(f, NICCY_SET_CLOCK, buf) < 0)
  	{
--- 71,78 ----
  
  	tt = time(NULL);
  	t = localtime(&tt);
! 	sprintf(buf, "%.2d%.2d%.2d%.2d%.2d%.4d", t->tm_hour,
! 		t->tm_min, t->tm_sec, t->tm_mday, t->tm_mon + 1, 1900+t->tm_year);
  
  	if (ioctl(f, NICCY_SET_CLOCK, buf) < 0)
  	{
*** gnu/usr.sbin/isdn/misc/stime.c.orig	Tue Jul  9 17:19:09 1996
--- gnu/usr.sbin/isdn/misc/stime.c	Tue Jul  9 17:19:24 1996
***************
*** 38,45 ****
  	}
  	tt = time(NULL);
  	t = localtime(&tt);
! 	sprintf(buf, "%.2d%.2d%.2d%.2d%.2d19%.2d", t->tm_hour,
! 		t->tm_min, t->tm_sec, t->tm_mday, t->tm_mon + 1, t->tm_year);
  
  	if (ioctl(f, NICCY_SET_CLOCK, buf) < 0)
  	{
--- 38,45 ----
  	}
  	tt = time(NULL);
  	t = localtime(&tt);
! 	sprintf(buf, "%.2d%.2d%.2d%.2d%.2d%.4d", t->tm_hour,
! 		t->tm_min, t->tm_sec, t->tm_mday, t->tm_mon + 1, 1900+t->tm_year);
  
  	if (ioctl(f, NICCY_SET_CLOCK, buf) < 0)
  	{
>Release-Note:
>Audit-Trail:

From: Mike Pritchard <mpp>
To: sjr@zombie.ncsc.mil (Stephen J. Roznowski)
Cc: FreeBSD-gnats-submit@freebsd.org
Subject: Re: misc/1380: Year 2000 breakage with tm_year
Date: Wed, 10 Jul 1996 18:35:45 -0700 (PDT)

 Stephen J. Roznowski wrote:
 > >Description:
 > 
 > 	Several programs have a hardcoded 19 in responses for the year.
 > 	This will break in 4 years...
 > [...]
 > --- 1467,1474 ----
 > 				struct tm *gmtime();
 > 				t = gmtime(&stbuf.st_mtime);
 > 				reply(213,
 > ! 					    "%04d%02d%02d%02d%02d%02d",
 > ! 					    1900+t->tm_year, t->tm_mon+1, t->tm_mday,
 
 Isn't there a TM_YEAR_BASE symbol defined somewhere that should
 be used instead of a hardcoded 1900?
 -- 
 Mike Pritchard
 mpp@FreeBSD.org
 "Go that way.  Really fast.  If something gets in your way, turn"

From: "Stephen J. Roznowski" <sjr@zombie.ncsc.mil>
To: mpp@freefall.freebsd.org
Cc: FreeBSD-gnats-submit@freebsd.org
Subject: Re: misc/1380: Year 2000 breakage with tm_year
Date: Wed, 10 Jul 1996 21:50:52 -0400

 > From: Mike Pritchard <mpp@freefall.freebsd.org>
 > Subject: Re: misc/1380: Year 2000 breakage with tm_year
 > 
 > Stephen J. Roznowski wrote:
 > > >Description:
 > > 
 > > 	Several programs have a hardcoded 19 in responses for the year.
 > > 	This will break in 4 years...
 > > [...]
 > > --- 1467,1474 ----
 > > 				struct tm *gmtime();
 > > 				t = gmtime(&stbuf.st_mtime);
 > > 				reply(213,
 > > ! 					    "%04d%02d%02d%02d%02d%02d",
 > > ! 					    1900+t->tm_year, t->tm_mon+1, t->tm_mday,
 > 
 > Isn't there a TM_YEAR_BASE symbol defined somewhere that should
 > be used instead of a hardcoded 1900?
 
 When I submitted my original changes to NetBSD, I used that symbol;
 however, according to "J.T. Conklin <jtc@NetBSD.ORG>" the definition
 of the tm_year field is "years since 1900" according to Standard C.
 [and not years since TM_YEAR_BASE]
 
 -SR
State-Changed-From-To: open->closed 
State-Changed-By: pst 
State-Changed-When: Sun Oct 20 10:57:32 PDT 1996 
State-Changed-Why:  
I've just done a new YTK survey using the find hack. 
We should now be YTK clean in all code/hardware support that we control. 
The following files are still "questionable" but interact with stuff outside 
our control: 
contrib/cvs/contrib/sccs2rcs.csh    (sccs file format) 
usr.sbin/xntpd/parse/clk_trimtsip.c (hardware clock) 

I did not make patches to fix the old isdn software on the yacc tests, since 
that code is soon to die or times are irrelevant. 
>Unformatted:
