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 <mhorne063@gmail.com> Differential Revision: https://reviews.freebsd.org/D19627
This commit is contained in:
parent
1a01705458
commit
286258a9a0
@ -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;
|
||||
|
@ -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"
|
||||
|
Loading…
x
Reference in New Issue
Block a user