Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 8099 - Elm 2.5.1 has Y2K problem in expires
Summary: Elm 2.5.1 has Y2K problem in expires
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: elm
Version: 6.1
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Trond Eivind Glomsrxd
QA Contact:
URL:
Whiteboard:
: 10908 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2000-01-01 15:53 UTC by John Franks
Modified: 2008-05-01 15:37 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2000-01-04 13:52:04 UTC


Attachments (Terms of Use)
patch to fixe elm Y2K bug (deleted)
2000-01-01 15:56 UTC, John Franks
no flags Details | Diff

Description John Franks 2000-01-01 15:53:37 UTC
Elm has a Y2K problem in determining whether a message has expired.  There
are actually two bugs.  Years after 2000 are considered as 1900.  A second
bug causes nothing to be considered expired in 2000.  But everything will
be considered expired after 2001 since the expiration date will be assumed
to be in 1901.

Here is patch which fixes the problem.

--- expires.c.old       Fri Sep 29 12:42:07 1995
+++ expires.c   Sat Jan  1 09:31:32 2000
@@ -46,6 +46,7 @@
        time_t thetime;
        char word1[WLEN], word2[WLEN], word3[WLEN], word4[WLEN],
word5[WLEN];
        int  month = 0, day = 0, year = 0, hour = 0, minute = 0, items;
+       int bad_year = FALSE;
 #ifndef        _POSIX_SOURCE
        struct tm *localtime();
        time_t time();
@@ -87,6 +88,7 @@
          day   = atoi(word1);
          month = month_number(word2);
          year  = atoi(word3);
+         bad_year = !isdigit( *word4);
          sscanf(word4, "%02d%*c%02d",
               &hour, &minute);
        }
@@ -100,25 +102,35 @@
              month = month_number(word3);
              day   = atoi(word2);
              year  = atoi(word4);
+             bad_year = !isdigit( *word4);
          } else {                                 /* form #1 */
              month = month_number(word2);
              day   = atoi(word3);
              year  = atoi(word4);
+             bad_year = !isdigit( *word4);
          }
        }
        else if (! isdigit(word1[0])) {            /* form #3 */
          month = month_number(word1);
          day   = atoi(word2);
          year  = atoi(word3);
+         bad_year = !isdigit( *word3);
        }
        else {                                     /* form #4 */
          day   = atoi(word1);
          month = month_number(word2);
          year  = atoi(word3);
+         bad_year = !isdigit( *word3);
        }

-       if (day == 0 || year == 0)
+       if (day == 0 || bad_year)
          return;                       /* we didn't get a valid date */
+
+       if ( year < 69)
+         year += 100;
+
+       if ( year >= 1900)
+         year -= 1900;

        /** next let's get the current time and date, please **/

--- date.c.old  Mon Apr  5 08:03:12 1999
+++ date.c      Sat Jan  1 09:31:24 2000
@@ -98,7 +98,7 @@

         /* now, finally, build the actual date string */
         the_time->tm_mday %= 32,
-       strftime(buffer, SLEN, "%a, %d %B %y", the_time);
+       strftime(buffer, SLEN, "%a, %d %B %Y", the_time);
 }

Comment 1 John Franks 2000-01-01 15:56:59 UTC
Created attachment 48 [details]
patch to fixe elm Y2K bug

Comment 2 John Franks 2000-01-03 15:48:59 UTC
There is an error in the patch listed in the report and in the attached
file.

Where the lines

          year  = atoi(word3);
 +         bad_year = !isdigit( *word4);

first occur (the first occurrence of !isdigit) the "*word4"  should be
changed to "*word3" so the lines become

           year  = atoi(word3);
 +         bad_year = !isdigit( *word3);

Comment 3 Jeff Johnson 2000-01-04 13:52:59 UTC
Fixed in elm-2.5.2-1. Thanks for the patch.

Comment 4 Trond Eivind Glomsrxd 2001-04-18 20:50:38 UTC
*** Bug 10908 has been marked as a duplicate of this bug. ***


Note You need to log in before you can comment on or make changes to this bug.