From owner-freebsd-bugs Tue Sep 30 09:50:06 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.7/8.8.7) id JAA06555 for bugs-outgoing; Tue, 30 Sep 1997 09:50:06 -0700 (PDT) Received: (from gnats@localhost) by hub.freebsd.org (8.8.7/8.8.7) id JAA06543; Tue, 30 Sep 1997 09:50:02 -0700 (PDT) Resent-Date: Tue, 30 Sep 1997 09:50:02 -0700 (PDT) Resent-Message-Id: <199709301650.JAA06543@hub.freebsd.org> Resent-From: gnats (GNATS Management) Resent-To: freebsd-bugs Resent-Reply-To: FreeBSD-gnats@FreeBSD.ORG, blank@sliphost37.uni-trier.de Received: from sliphost37.uni-trier.de (root@sliphost37.uni-trier.de [136.199.240.37]) by hub.freebsd.org (8.8.7/8.8.7) with ESMTP id JAA05849 for ; Tue, 30 Sep 1997 09:40:24 -0700 (PDT) Received: (from blank@localhost) by sliphost37.uni-trier.de (8.8.7/8.8.7) id SAA05444; Tue, 30 Sep 1997 18:39:13 +0200 (CEST) Message-Id: <199709301639.SAA05444@sliphost37.uni-trier.de> Date: Tue, 30 Sep 1997 18:39:13 +0200 (CEST) From: Sascha Blank Reply-To: blank@sliphost37.uni-trier.de To: FreeBSD-gnats-submit@FreeBSD.ORG X-Send-Pr-Version: 3.2 Subject: bin/4661: date(1) in 2.2-STABLE does not allow to set times with ".ss" Sender: owner-freebsd-bugs@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk >Number: 4661 >Category: bin >Synopsis: date(1) in 2.2-STABLE does not allow to set times with ".ss" >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-bugs >State: open >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Tue Sep 30 09:50:01 PDT 1997 >Last-Modified: >Originator: Sascha Blank >Organization: >Release: FreeBSD 2.2-STABLE i386 >Environment: A very recent 2.2-STABLE system. blank in /usr/src/bin/date (331): ident date.c date.c: $Id: date.c,v 1.7.2.3 1997/09/14 13:07:05 jkh Exp $ >Description: date(1) does not allow to set the time and/or date when the time string the user has given contains the ".ss" seconds field. Whenever this is done the string is rejected as being in the wrong format. >How-To-Repeat: "date 1000" or "date 9709301000" work. But "date 1000.00" or "date 9709301000.20" don't work and produce this message: date: illegal time format usage: date [-nu] [-d dst] [-r seconds] [-t west] [+format] [-v [+|-]val[ymwdHM]] ... [-f fmt date | [[[[yy]mm]dd]HH]MM[.ss]] even though the strings are correct according to the template. >Fix: This small diff fixes the problem. The switch-statement starting in line 216 in date.c always expects a time string where the ".ss" field has been removed. Unfortunately this is not the case when a string like "1000.30" is passed to date(1). *** date.c.ctm Tue Sep 30 18:06:14 1997 --- date.c Tue Sep 30 18:37:38 1997 *************** *** 213,219 **** } else lt->tm_sec = 0; ! switch (strlen(p)) { case 10: /* yy */ lt->tm_year = ATOI2(p); if (lt->tm_year < 69) /* hack for 2000 ;-} */ --- 213,220 ---- } else lt->tm_sec = 0; ! /* if p has a ".ss" field then let's pretend it's not there */ ! switch (strlen(p) - ((dot != NULL) ? 3 : 0)) { case 10: /* yy */ lt->tm_year = ATOI2(p); if (lt->tm_year < 69) /* hack for 2000 ;-} */ -- Sascha Blank - mailto:blank@fox.uni-trier.de Student and System Administrator at the University of Trier, Germany Finger my account to receive my Public PGP key I don't speak for my employers, they don't pay me enough for that. >Audit-Trail: >Unformatted: