]> 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>
Mon, 12 Feb 2024 20:17:13 +0000 (13:17 -0700)
commitf2c72486da30eda54f0db1a9b7ca822afc835ecf
treec16a23a8d2559f0f5cabace5ce481f7c33b95b0c
parent3e6382c1eda5ea4451a64ec69fd8a92f621aca55
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
Sponsored by: Axcient
Reviewed by: emaste
Approved by: re (cperciva)
Differential Revision: https://reviews.freebsd.org/D43590

(cherry picked from commit 65e25e4a614a99243e7419279b294e399991dfff)
sys/fs/fuse/fuse_internal.c
sys/fs/fuse/fuse_node.c
tests/sys/fs/fusefs/getattr.cc
tests/sys/fs/fusefs/lookup.cc