[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#196177: marked as done (libc6: mktime mishandles dates before 1970 (regression from 3.0r1))



Your message dated Sat, 18 Feb 2006 17:03:07 +0100
with message-id <20060218160307.GA15083@bode.aurel32.net>
and subject line Bugs fixed in glibc 2.3.5-1
has caused the attached Bug report to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what I am
talking about this indicates a serious mail system misconfiguration
somewhere.  Please contact me immediately.)

Debian bug tracking system administrator
(administrator, Debian Bugs database)

--- Begin Message ---
Package: libc6
Version: 2.3.1-16
Severity: normal
Tags: patch

I ran into this problem because I assigned a Python programming time
zone problem to my students
<http://www.cs.ucla.edu/classes/spring03/cs131/hw/pr2.html>.  Students
who were running Debian testing could not do the assignment because
their programs mishandled dates before 1970.  Students who were
running Debian stable (3.0r1) worked fine, as did students running
Solaris.  So this is a regression from 3.0r1.

The problem is that in libc6 2.3.1-16, mktime always returns -1 for
dates that are before 1970.

Here is a patch:

http://savannah.gnu.org/cgi-bin/viewcvs/gnulib/gnulib/lib/mktime.c.diff?r1=1.35&r2=1.36

Here is a test program illustrating the bug:

#include <time.h>
#include <stdio.h>
#include <stdlib.h>

struct tm tm, tm0;

int
main (void)
{
  time_t t;

  tm0.tm_sec = 0;
  tm0.tm_min = 0;
  tm0.tm_hour = 0;
  tm0.tm_year = 1968 - 1900;
  tm0.tm_mon = 1 - 1;
  tm0.tm_mday = 1;
  tm = tm0;

  putenv ("TZ=UTC0");
  t = mktime (&tm);

  if (t != (time_t) -1
      && tm.tm_sec == tm0.tm_sec
      && tm.tm_min == tm0.tm_min
      && tm.tm_hour == tm0.tm_hour
      && tm.tm_mday == tm0.tm_mday
      && tm.tm_mon == tm0.tm_mon
      && tm.tm_year == tm0.tm_year)
    {
      printf ("test succeeded\n");
      return 0;
    }
  else
    {
      printf ("test failed\n");
      return 1;
    }
}


--- End Message ---
--- Begin Message ---
These bugs reports are actually the same bug, and have been fixed in
glibc 2.3.5-1, meaning that they it is now fixed in etch and sid. I 
am therefore closing the bugs.

-- 
  .''`.  Aurelien Jarno	            | GPG: 1024D/F1BCDB73
 : :' :  Debian developer           | Electrical Engineer
 `. `'   aurel32@debian.org         | aurelien@aurel32.net
   `-    people.debian.org/~aurel32 | www.aurel32.net

--- End Message ---

Reply to: