Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 9 Jul 1996 21:18:02 -0400
From:      "Stephen J. Roznowski" <sjr@zombie.ncsc.mil>
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   misc/1380: Year 2000 breakage with tm_year
Message-ID:  <199607100118.VAA13250@zombie.ncsc.mil>
Resent-Message-ID: <199607100120.SAA23012@freefall.freebsd.org>

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

>Number:         1380
>Category:       misc
>Synopsis:       Year 2000 breakage with tm_year
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Jul  9 18:20:01 PDT 1996
>Last-Modified:
>Originator:     Stephen J. Roznowski
>Organization:
>Release:        FreeBSD 2.2-960612-SNAP i386
>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)
  	{
>Audit-Trail:
>Unformatted:



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