Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 9 Sep 2019 17:22:11 +0000 (UTC)
From:      Ed Maste <emaste@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org
Subject:   svn commit: r352077 - in stable/12/usr.sbin/makefs: . tests
Message-ID:  <201909091722.x89HMB2h077006@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: emaste
Date: Mon Sep  9 17:22:11 2019
New Revision: 352077
URL: https://svnweb.freebsd.org/changeset/base/352077

Log:
  MFC r345281: makefs: Fix "time" mtree attribute handling
  
  When processing mtree(5) MANIFEST files, makefs(8) previously threw an
  error if it encountered an entry whose "time" attribute contained a
  non-zero subsecond component (e.g. time=1551620152.987220000).
  
  Update the handling logic to properly assign the subsecond component if
  built with nanosecond support, or silently discard it otherwise.
  
  Also, re-enable the time attribute for the kyua tests.
  
  PR:		194703
  Submitted by:	mhorne

Modified:
  stable/12/usr.sbin/makefs/mtree.c
  stable/12/usr.sbin/makefs/tests/makefs_tests_common.sh
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/usr.sbin/makefs/mtree.c
==============================================================================
--- stable/12/usr.sbin/makefs/mtree.c	Mon Sep  9 16:37:38 2019	(r352076)
+++ stable/12/usr.sbin/makefs/mtree.c	Mon Sep  9 17:22:11 2019	(r352077)
@@ -644,14 +644,17 @@ read_mtree_keywords(FILE *fp, fsnode *node)
 				st->st_atime = num;
 				st->st_ctime = num;
 				st->st_mtime = num;
+#if HAVE_STRUCT_STAT_ST_MTIMENSEC
 				if (p == NULL)
 					break;
 				error = read_number(p, 10, &num, 0,
 				    INTMAX_MAX);
 				if (error)
 					break;
-				if (num != 0)
-					error = EINVAL;
+				st->st_atimensec = num;
+				st->st_ctimensec = num;
+				st->st_mtimensec = num;
+#endif
 			} else if (strcmp(keyword, "type") == 0) {
 				if (value == NULL) {
 					error = ENOATTR;

Modified: stable/12/usr.sbin/makefs/tests/makefs_tests_common.sh
==============================================================================
--- stable/12/usr.sbin/makefs/tests/makefs_tests_common.sh	Mon Sep  9 16:37:38 2019	(r352076)
+++ stable/12/usr.sbin/makefs/tests/makefs_tests_common.sh	Mon Sep  9 17:22:11 2019	(r352077)
@@ -29,13 +29,7 @@
 
 KB=1024
 : ${TMPDIR=/tmp}
-# TODO: add mtree `time` support; get a lot of errors like this right now when
-# passing generating disk images with keyword mtree support, like:
-#
-# `[...]/mtree.spec:8: error: time: invalid value '1446458503'`
-#
-#DEFAULT_MTREE_KEYWORDS="type,mode,gid,uid,size,link,time"
-DEFAULT_MTREE_KEYWORDS="type,mode,gid,uid,size,link"
+DEFAULT_MTREE_KEYWORDS="type,mode,gid,uid,size,link,time"
 TEST_IMAGE="$TMPDIR/test.img"
 TEST_INPUTS_DIR="$TMPDIR/inputs"
 TEST_MD_DEVICE_FILE="$TMPDIR/md.output"



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201909091722.x89HMB2h077006>