Subject: lib/24898: emacs thinks mktime is broken
To: None <gnats-bugs@gnats.NetBSD.org>
From: None <wolfgang@wsrcc.com>
List: netbsd-bugs
Date: 03/23/2004 23:50:53
>Number:         24898
>Category:       lib
>Synopsis:       emacs thinks mktime is broken
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    lib-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Mar 24 07:52:00 UTC 2004
>Closed-Date:
>Last-Modified:
>Originator:     Wolfgang S. Rupprecht
>Release:        NetBSD 1.6ZK
>Organization:
W S Rupprecht Computer Consulting, Fremont CA
>Environment:
	
	
System: NetBSD capsicum.wsrcc.com 1.6ZK NetBSD 1.6ZK (WSRCC_ATHLON) #3: Sun Mar 21 08:51:31 PST 2004 wolfgang@capsicum.wsrcc.com:/var/obj/netbsd/sys/arch/i386/compile/WSRCC_ATHLON i386
Architecture: i386
Machine: i386
>Description:
	emacs's configure prints out a message indicating that
	netbsd's mktime is broken.

>How-To-Repeat:

    compile and run this code (snipped from
    /usr/pkgsrc/editors/emacs/work/emacs-21.3/configure).

#include <stdio.h>
#include <stdlib.h>
#include <sys/time.h>
#include <time.h>
#include <unistd.h>

/* Fail if mktime fails to convert a date in the spring-forward gap.
   Based on a problem report from Andreas Jaeger.  */
int
main ()
{
  /* glibc (up to about 1998-10-07) failed this test) */
  struct tm tm;

  /* Use the portable POSIX.1 specification "TZ=PST8PDT,M4.1.0,M10.5.0"
     instead of "TZ=America/Vancouver" in order to detect the bug even
     on systems that don't support the Olson extension, or don't have the
     full zoneinfo tables installed.  */
  putenv ("TZ=PST8PDT,M4.1.0,M10.5.0");

  tm.tm_year = 98;
  tm.tm_mon = 3;
  tm.tm_mday = 5;
  tm.tm_hour = 2;
  tm.tm_min = 0;
  tm.tm_sec = 0;
  tm.tm_isdst = -1;
  if (mktime (&tm) == (time_t)-1){
      fprintf(stderr, "Death by rue-rue\n");
      exit (1);
  }

  exit (0);
}
	

>Fix:
	
>Release-Note:
>Audit-Trail:
>Unformatted: