From owner-svn-src-head@FreeBSD.ORG Sat Jan 31 05:17:28 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AA098106564A; Sat, 31 Jan 2009 05:17:28 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8EA658FC14; Sat, 31 Jan 2009 05:17:28 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0V5HSV0012763; Sat, 31 Jan 2009 05:17:28 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0V5HSpp012759; Sat, 31 Jan 2009 05:17:28 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200901310517.n0V5HSpp012759@svn.freebsd.org> From: Tim Kientzle Date: Sat, 31 Jan 2009 05:17:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187940 - head/usr.sbin/mtree X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Jan 2009 05:17:29 -0000 Author: kientzle Date: Sat Jan 31 05:17:28 2009 New Revision: 187940 URL: http://svn.freebsd.org/changeset/base/187940 Log: Write timestamps with exactly 9 digits after the period. This ensures that the value written is both compatible with older mtree versions (which expect the value after the period to be an integer count of nanoseconds after the whole second) and is a correct floating-point value. Leave the parsing code unchanged so it will continue to read older files. Modified: head/usr.sbin/mtree/create.c head/usr.sbin/mtree/mtree.5 head/usr.sbin/mtree/mtree.8 head/usr.sbin/mtree/spec.c Modified: head/usr.sbin/mtree/create.c ============================================================================== --- head/usr.sbin/mtree/create.c Fri Jan 30 23:40:24 2009 (r187939) +++ head/usr.sbin/mtree/create.c Sat Jan 31 05:17:28 2009 (r187940) @@ -212,7 +212,7 @@ statf(int indent, FTSENT *p) output(indent, &offset, "size=%jd", (intmax_t)p->fts_statp->st_size); if (keys & F_TIME) - output(indent, &offset, "time=%ld.%ld", + output(indent, &offset, "time=%ld.%09ld", (long)p->fts_statp->st_mtimespec.tv_sec, p->fts_statp->st_mtimespec.tv_nsec); if (keys & F_CKSUM && S_ISREG(p->fts_statp->st_mode)) { Modified: head/usr.sbin/mtree/mtree.5 ============================================================================== --- head/usr.sbin/mtree/mtree.5 Fri Jan 30 23:40:24 2009 (r187939) +++ head/usr.sbin/mtree/mtree.5 Sat Jan 31 05:17:28 2009 (r187940) @@ -200,7 +200,9 @@ The size, in bytes, of the file. .It Cm link The file the symbolic link is expected to reference. .It Cm time -The last modification time of the file. +The last modification time of the file, in seconds and nanoseconds. +The value should include a period character and exactly nine digits +after the period. .It Cm type The type of the file; may be set to any one of the following: .Pp Modified: head/usr.sbin/mtree/mtree.8 ============================================================================== --- head/usr.sbin/mtree/mtree.8 Fri Jan 30 23:40:24 2009 (r187939) +++ head/usr.sbin/mtree/mtree.8 Sat Jan 31 05:17:28 2009 (r187940) @@ -233,7 +233,9 @@ The size, in bytes, of the file. .It Cm link The file the symbolic link is expected to reference. .It Cm time -The last modification time of the file. +The last modification time of the file, in seconds and nanoseconds. +The value should include a period character and exactly nine digits +after the period. .It Cm type The type of the file; may be set to any one of the following: .Pp Modified: head/usr.sbin/mtree/spec.c ============================================================================== --- head/usr.sbin/mtree/spec.c Fri Jan 30 23:40:24 2009 (r187939) +++ head/usr.sbin/mtree/spec.c Sat Jan 31 05:17:28 2009 (r187940) @@ -255,6 +255,8 @@ set(char *t, NODE *ip) case F_TIME: ip->st_mtimespec.tv_sec = strtoul(val, &ep, 10); if (*ep == '.') { + /* Note: we require exactly nine + * digits after the decimal point. */ val = ep + 1; ip->st_mtimespec.tv_nsec = strtoul(val, &ep, 10);