Author: emaste
Date: Mon Mar 18 19:26:36 2019
New Revision: 345281
URL: https://svnweb.freebsd.org/changeset/base/345281

Log:
  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: Mitchell Horne <mhorne...@gmail.com>
  Differential Revision:        https://reviews.freebsd.org/D19627

Modified:
  head/usr.sbin/makefs/mtree.c
  head/usr.sbin/makefs/tests/makefs_tests_common.sh

Modified: head/usr.sbin/makefs/mtree.c
==============================================================================
--- head/usr.sbin/makefs/mtree.c        Mon Mar 18 19:23:19 2019        
(r345280)
+++ head/usr.sbin/makefs/mtree.c        Mon Mar 18 19:26:36 2019        
(r345281)
@@ -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: head/usr.sbin/makefs/tests/makefs_tests_common.sh
==============================================================================
--- head/usr.sbin/makefs/tests/makefs_tests_common.sh   Mon Mar 18 19:23:19 
2019        (r345280)
+++ head/usr.sbin/makefs/tests/makefs_tests_common.sh   Mon Mar 18 19:26:36 
2019        (r345281)
@@ -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"
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to