HomeFreeBSD

fusefs: fix invalid value for st_birthtime.tv_nsec

Description

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
Differential Revision: https://reviews.freebsd.org/D43590

(cherry picked from commit 55b80e2ca52c4b27c4920d372a6e71ac9ab7da9e)

Details

Provenance
asomersAuthored on Jan 25 2024, 3:19 PM
Reviewer
emaste
Differential Revision
D43590: fusefs: fix invalid value for st_birthtime.tv_nsec
Parents
rG314a881fce0c: fusefs: fix some memory leaks in the tests
Branches
Unknown
Tags
Unknown