[7478] in SIPB bug reports
Re: rn bug
daemon@ATHENA.MIT.EDU (John Hawkinson)
Sun Jan 16 16:06:32 2000
Message-Id: <200001162106.QAA25731@x15-cruise-basselope.mit.edu>
To: John Carr <jfc@MIT.EDU>
Cc: bug-sipb@MIT.EDU
In-Reply-To: Your message of "Tue, 11 Jan 2000 23:47:11 EST."
<200001120447.XAA10614@nerd-xing.mit.edu>
Date: Sun, 16 Jan 2000 16:06:17 -0500
From: John Hawkinson <jhawk@MIT.EDU>
In message <200001120447.XAA10614@nerd-xing.mit.edu>, John Carr writes:
>
>> p.s. JFC, I think a patch might not be looked at askance.
>
>I don't have time to test a fix tonight, but I think that the following
>code in trn-3.6/parsedate.y:Convert() displays a common Y2K bug:
>
> if (Year < 0)
> Year = -Year;
> if (Year < 100)
> Year += 1900;
> if (Year < EPOCH)
> Year += 100;
Special.
I've patched it as below and installed it as trn.test in the sipb
locker for Solaris. If you could confirm that helps, I'd
appreciate it.
--jhawk
p.s.: bug-sipb: this really sucks.
p.p.s: I thought someone else reported this problem, too, but could not
find the bug report. Anyone?
*** 1.1 1993/06/03 20:40:33
--- 1.2 2000/01/16 21:02:43
***************
*** 1,5 ****
%{
! /* $Revision: 1.1 $
**
** Originally written by Steven M. Bellovin <smb@research.att.com> while
** at the University of North Carolina at Chapel Hill. Later tweaked by
--- 1,6 ----
%{
! /* from: Revision: 1.12
! * $Header: /mit/sipb/src/trn-3.6/RCS/parsedate.y,v 1.2 2000/01/16 21:02:43 jhawk Exp $
**
** Originally written by Steven M. Bellovin <smb@research.att.com> while
** at the University of North Carolina at Chapel Hill. Later tweaked by
***************
*** 9,14 ****
--- 10,18 ----
** names) in August, 1991, by Rich. Paul Eggert <eggert@twinsun.com>
** helped in September, 1992.
**
+ ** John Hawkinson <jhawk@MIt.EDU> corrected a Y2K problem in tm_year handling
+ ** in January, 2000.
+ **
** This grammar has six shift/reduce conflicts.
**
** This code is in the public domain and has no copyright.
***************
*** 470,479 ****
static time_t
! Convert(Month, Day, Year, Hours, Minutes, Seconds, Meridian, dst)
time_t Month;
time_t Day;
! time_t Year;
time_t Hours;
time_t Minutes;
time_t Seconds;
--- 474,483 ----
static time_t
! Convert(Month, Day, tm_year, Hours, Minutes, Seconds, Meridian, dst)
time_t Month;
time_t Day;
! time_t tm_year;
time_t Hours;
time_t Minutes;
time_t Seconds;
***************
*** 495,507 ****
register time_t Julian;
register int i;
time_t tod;
- if (Year < 0)
- Year = -Year;
- if (Year < 100)
- Year += 1900;
- if (Year < EPOCH)
- Year += 100;
for (mp = DaysNormal, yp = LeapYears; yp < ENDOF(LeapYears); yp++)
if (Year == *yp) {
mp = DaysLeap;
--- 499,508 ----
register time_t Julian;
register int i;
time_t tod;
+ time_t Year;
+
+ Year = tm_year+1900;
for (mp = DaysNormal, yp = LeapYears; yp < ENDOF(LeapYears); yp++)
if (Year == *yp) {
mp = DaysLeap;