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
Approved by: re (cperciva)
Differential Revision: https://reviews.freebsd.org/D43590

(cherry picked from commit 65e25e4a614a99243e7419279b294e399991dfff)

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
rG3e6382c1eda5: inpcb: Restore some NULL checks of credential pointers
Branches
Unknown
Tags
Unknown