aboutsummaryrefslogtreecommitdiff
path: root/tests/sys/fs/fusefs/lookup.cc
diff options
context:
space:
mode:
authorAlan Somers <asomers@FreeBSD.org>2024-01-25 15:19:37 +0000
committerAlan Somers <asomers@FreeBSD.org>2024-02-12 17:43:11 +0000
commit739488cc21b1ad08994aa5c36d85b9c11866b29d (patch)
treeb3cbf9b89dee556978d662c79abd0d6f0e526a1d /tests/sys/fs/fusefs/lookup.cc
parent314a881fce0cd48ee4f67fb924432f53d4de0ea0 (diff)
downloadsrc-739488cc21b1ad08994aa5c36d85b9c11866b29d.tar.gz
src-739488cc21b1ad08994aa5c36d85b9c11866b29d.zip
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)
Diffstat (limited to 'tests/sys/fs/fusefs/lookup.cc')
-rw-r--r--tests/sys/fs/fusefs/lookup.cc15
1 files changed, 9 insertions, 6 deletions
diff --git a/tests/sys/fs/fusefs/lookup.cc b/tests/sys/fs/fusefs/lookup.cc
index 549df0369fa7..6d506c1ab700 100644
--- a/tests/sys/fs/fusefs/lookup.cc
+++ b/tests/sys/fs/fusefs/lookup.cc
@@ -112,12 +112,15 @@ TEST_F(Lookup, attr_cache)
// fuse(4) does not _yet_ support inode generations
//EXPECT_EQ(generation, sb.st_gen);
- //st_birthtim and st_flags are not supported by protocol 7.8. They're
- //only supported as OS-specific extensions to OSX.
- //EXPECT_EQ(, sb.st_birthtim);
- //EXPECT_EQ(, sb.st_flags);
-
- //FUSE can't set st_blksize until protocol 7.9
+ /*
+ * st_birthtim and st_flags are not supported by the fuse protocol.
+ * They're only supported as OS-specific extensions to OSX. For
+ * birthtime, the convention for "not supported" is "negative one
+ * second".
+ */
+ EXPECT_EQ(-1, sb.st_birthtim.tv_sec);
+ EXPECT_EQ(0, sb.st_birthtim.tv_nsec);
+ EXPECT_EQ(0u, sb.st_flags);
}
/*