]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
fusefs: fix invalid value for st_birthtime.tv_nsec
authorAlan Somers <asomers@FreeBSD.org>
Thu, 25 Jan 2024 15:19:37 +0000 (08:19 -0700)
committerAlan Somers <asomers@FreeBSD.org>
Sun, 4 Feb 2024 21:01:06 +0000 (14:01 -0700)
commit55b80e2ca52c4b27c4920d372a6e71ac9ab7da9e
treeaa2fee34e238d2eb3b078a7ba9fc7f4156b8fb81
parentcd724c25928d0d30761d118690b4ac75ca931b63
fusefs: fix invalid value for st_birthtime.tv_nsec

If a file system's on-disk format does not support st_birthtime, it
isn't clear what value it should return in stat(2).  Neither our man
page nor the OpenGroup specifies.  But our convention for UFS and
msdosfs is to return { .tv_sec = -1, .tv_nsec = 0 }.  fusefs is
different.  It returns { .tv_sec = -1, .tv_nsec = -1 }.  It's done that
ever since the initial import in SVN r241519.

Most software apparently handles this just fine.  It must, because we've
had no complaints.  But the Rust standard library will panic when
reading such a timestamp during std::fs::metadata, even if the caller
doesn't care about that particular value.  That's a separate bug, and
should be fixed.

Change our invalid value to match msdosfs and ufs, pacifying the Rust
standard library.

PR: 276602
MFC after: 1 week
Sponsored by: Axcient
Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D43590
sys/fs/fuse/fuse_internal.c
sys/fs/fuse/fuse_node.c
tests/sys/fs/fusefs/getattr.cc
tests/sys/fs/fusefs/lookup.cc