From akr@coulee.etl.go.jp  Thu May 24 19:10:28 2001
Return-Path: <akr@coulee.etl.go.jp>
Received: from mx1.aist.go.jp (mx1.aist.go.jp [150.29.246.133])
	by hub.freebsd.org (Postfix) with ESMTP id C003E37B424
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 24 May 2001 19:10:27 -0700 (PDT)
	(envelope-from akr@coulee.etl.go.jp)
Received: from rpsmtp1.aist.go.jp
	by mx1.aist.go.jp  with ESMTP id f4P2AL518560
	for <FreeBSD-gnats-submit@freebsd.org>; Fri, 25 May 2001 11:10:21 +0900 (JST)
	env-from (akr@coulee.etl.go.jp)
Received: from eccu1-1.etl.go.jp
        by rpsmtp1.aist.go.jp  with ESMTP id f4P2ALP24114
        for <FreeBSD-gnats-submit@freebsd.org>; Fri, 25 May 2001 11:10:21 +0900 (JST)
        env-from (akr@coulee.etl.go.jp)
Received: from flux.etl.go.jp (dhcpea003 [150.29.203.193])
	by eccu1-1.etl.go.jp (8.9.3/3.7W-ETL-MASTER) with ESMTP id LAA24838
	for <FreeBSD-gnats-submit@freebsd.org>; Fri, 25 May 2001 11:10:20 +0900 (JST)
Received: by flux.etl.go.jp (Postfix, from userid 23483)
	id 01D54727; Fri, 25 May 2001 11:10:18 +0900 (JST)
Message-Id: <20010525021018.01D54727@flux.etl.go.jp>
Date: Fri, 25 May 2001 11:10:18 +0900 (JST)
From: akr@m17n.org
Sender: akr@coulee.etl.go.jp
Reply-To: akr@m17n.org
To: FreeBSD-gnats-submit@freebsd.org
Subject: mktime problem.
X-Send-Pr-Version: 3.2

>Number:         27630
>Category:       bin
>Synopsis:       mktime failure.
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu May 24 19:20:00 PDT 2001
>Closed-Date:    Sat Jan 12 10:50:57 PST 2002
>Last-Modified:  Sat Jan 12 10:51:11 PST 2002
>Originator:     Tanaka Akira
>Release:        FreeBSD 4.2-RELEASE i386
>Organization:
m17n
>Environment:

FreeBSD flux 4.2-RELEASE FreeBSD 4.2-RELEASE #2: Fri Jan 12 22:55:02 JST 2001     akr@flux:/usr/src/sys/compile/AKR  i386

>Description:

mktime(3) fails on some condition.

For example, TZ=Africa/Monrovia, 1972/05/01 00:44:30 cannot be converted to
time_t.  Since this example is taken from `zdump -v Africa/Monrovia' and it
is after Epoch, there is no reason to fail.

Actually, I tested all time listed in `zdump -v' for each timezone in
/usr/share/zoneinfo and found many failures.  Above failure is one of them.

>How-To-Repeat:

% cat tst.c 
#include <stdio.h>
#include <time.h>

int main()
{
  struct tm a;
  time_t t;

  a.tm_year = 1972 - 1900;
  a.tm_mon = 5 - 1;
  a.tm_mday = 1;
  a.tm_hour = 0;
  a.tm_min = 44;
  a.tm_sec = 30;
  a.tm_wday = 0;
  a.tm_yday = 0;
  a.tm_isdst = -1;

  t = mktime(&a);
  if (t == -1) {
    perror("mktime");
    exit(1);
  }
  printf("no problem\n");
  return 0;
}
% gcc tst.c
% TZ=Africa/Monrovia ./a.out   
mktime: Undefined error: 0
% 

>Fix:

>Release-Note:
>Audit-Trail:

From: Garrett Wollman <wollman@khavrinen.lcs.mit.edu>
To: akr@m17n.org
Cc: FreeBSD-gnats-submit@FreeBSD.ORG
Subject: bin/27630: mktime problem.
Date: Fri, 25 May 2001 13:02:37 -0400 (EDT)

 <<On Fri, 25 May 2001 11:10:18 +0900 (JST), akr@m17n.org said:
 
 > mktime(3) fails on some condition.
 
 I am unable to duplicate your problem on a 4.2-STABLE system.  I
 suggest, however, that in the future you completely initialize your
 `struct tm', as you may be relying on undefined behavior.
 
 -GAWollman
 

From: Garrett Wollman <wollman@khavrinen.lcs.mit.edu>
To: akr@m17n.org
Cc: FreeBSD-gnats-submit@FreeBSD.ORG
Subject: bin/27630: mktime problem.
Date: Fri, 25 May 2001 13:08:21 -0400 (EDT)

 <<On Fri, 25 May 2001 11:10:18 +0900 (JST), akr@m17n.org said:
 
 > mktime(3) fails on some condition.
 
 Actually, I retract my previous statement.  I can indeed reproduce
 this bug.  I'll ask on the timezone mailing-list whether it is present
 in the current tzcode.
 
 -GAWollman
 
 
 
State-Changed-From-To: open->feedback 
State-Changed-By: wollman 
State-Changed-When: Tue Jun 5 13:48:33 PDT 2001 
State-Changed-Why:  
A fix from the maintainer was committed to current.  Does this fix resolve 
your problem? 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=27630 
State-Changed-From-To: feedback->closed 
State-Changed-By: bmah 
State-Changed-When: Sat Jan 12 10:50:57 PST 2002 
State-Changed-Why:  
Feedback timeout (6 months). 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=27630 
>Unformatted:
