From ishisone@sra.co.jp  Tue Jan  5 00:29:37 1999
Received: from sraigw.sra.co.jp (sraigw.sra.co.jp [202.32.10.2])
          by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id AAA16498
          for <FreeBSD-gnats-submit@freebsd.org>; Tue, 5 Jan 1999 00:29:36 -0800 (PST)
          (envelope-from ishisone@sra.co.jp)
Received: from sranhe.sra.co.jp (sranhe [133.137.44.3])
	by sraigw.sra.co.jp (8.8.7/3.6Wbeta7-sraigw) with ESMTP id RAA05083
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 5 Jan 1999 17:29:08 +0900 (JST)
Received: from srapc459.sra.co.jp (srapc459 [133.137.45.28])
	by sranhe.sra.co.jp (8.8.7/3.6Wbeta7-srambox) with ESMTP id RAA13814
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 5 Jan 1999 17:28:59 +0859 (JST)
Received: (from ishisone@localhost) by srapc459.sra.co.jp (8.8.8/3.4W-sra) id RAA29543; Tue, 5 Jan 1999 17:29:07 +0900 (JST)
Message-Id: <199901050829.RAA29543@srapc459.sra.co.jp>
Date: Tue, 5 Jan 1999 17:29:07 +0900 (JST)
From: ishisone@sra.co.jp
Reply-To: ishisone@sra.co.jp
To: FreeBSD-gnats-submit@freebsd.org
Subject: year 2000 problem with /usr/bin/touch
X-Send-Pr-Version: 3.2

>Number:         9323
>Category:       bin
>Synopsis:       year 2000 problem with /usr/bin/touch
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Jan  5 00:30:01 PST 1999
>Closed-Date:    Tue Jan 5 02:01:58 PST 1999
>Last-Modified:  Tue Jan  5 02:02:46 PST 1999
>Originator:     Makoto Ishisone
>Release:        FreeBSD 2.2.7-RELEASE i386
>Organization:
Software Research Associates, Inc.
>Environment:

>Description:

  When used in its obsolescent form (where the time is specified as the
  first argument), /usr/bin/touch doesn't treat the two-digit year
  specification correctly.  Years in the range of 00-68 should be treated
  as 2000-2068 according to the online manual, but actually they are
  treated as 1900-1968.

  Here's an excerpt from the manual's `COMPATIBILITY' section:
	If the ``YY'' letter pair is in the range 69 to 99, the year
	is set to 1969 to 1999, otherwise, the year is set in the 21st
	century.

>How-To-Repeat:

  Try following commands.  You'll find that the modification time of
  the file is 1910, not 2010.

	% touch 0101000010 /tmp/touchme
	% ls -l /tmp/touchme

>Fix:

*** touch.c.org	Fri Jul 17 16:25:26 1998
--- touch.c	Tue Jan  5 16:10:45 1999
***************
*** 260,267 ****
  	t->tm_mday = ATOI2(arg);
  	t->tm_hour = ATOI2(arg);
  	t->tm_min = ATOI2(arg);
! 	if (year)
  		t->tm_year = ATOI2(arg);
  
  	t->tm_isdst = -1;		/* Figure out DST. */
  	tvp[0].tv_sec = tvp[1].tv_sec = mktime(t);
--- 260,270 ----
  	t->tm_mday = ATOI2(arg);
  	t->tm_hour = ATOI2(arg);
  	t->tm_min = ATOI2(arg);
! 	if (year) {
  		t->tm_year = ATOI2(arg);
+ 		if (t->tm_year < 69)
+ 			t->tm_year += 100;
+ 	}
  
  	t->tm_isdst = -1;		/* Figure out DST. */
  	tvp[0].tv_sec = tvp[1].tv_sec = mktime(t);

>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: danny 
State-Changed-When: Tue Jan 5 02:01:58 PST 1999 
State-Changed-Why:  
Patch applied with minor mod.  Thanks. 
>Unformatted:
