From c01d6b76cef9dfd79ee31d724312c142ba35ae6a Mon Sep 17 00:00:00 2001 From: Firelight Flagboy Date: Fri, 20 Dec 2024 11:56:58 +0100 Subject: [PATCH] Fix #8942: Fix the `ctime` of files set to the `created` time instead of the `updated` time. --- libparsec/crates/platform_mountpoint/src/unix/filesystem.rs | 6 ++++-- newsfragments/8942.bugfix.rst | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) create mode 100644 newsfragments/8942.bugfix.rst diff --git a/libparsec/crates/platform_mountpoint/src/unix/filesystem.rs b/libparsec/crates/platform_mountpoint/src/unix/filesystem.rs index bec1c9b84e4..af1c92afdc7 100644 --- a/libparsec/crates/platform_mountpoint/src/unix/filesystem.rs +++ b/libparsec/crates/platform_mountpoint/src/unix/filesystem.rs @@ -32,6 +32,8 @@ const TTL: std::time::Duration = std::time::Duration::ZERO; /// same time. const GENERATION: u64 = 0; const BLOCK_SIZE: u64 = 512; +/// Default permissions for files and folders. +/// Equivalent to `chmod` flags `all=,u=rwx`. const PERMISSIONS: u16 = 0o700; fn os_name_to_entry_name(name: &OsStr) -> EntryNameResult { @@ -49,7 +51,7 @@ fn file_stat_to_file_attr(stat: FileStat, inode: Inode, uid: u32, gid: u32) -> f blocks: (stat.size + BLOCK_SIZE - 1) / BLOCK_SIZE, atime: updated, mtime: updated, - ctime: created, + ctime: updated, crtime: created, kind: fuser::FileType::RegularFile, perm: PERMISSIONS, @@ -78,7 +80,7 @@ fn entry_stat_to_file_attr(stat: EntryStat, inode: Inode, uid: u32, gid: u32) -> blocks: (size + BLOCK_SIZE - 1) / BLOCK_SIZE, atime: updated, mtime: updated, - ctime: created, + ctime: updated, crtime: created, kind: fuser::FileType::RegularFile, perm: PERMISSIONS, diff --git a/newsfragments/8942.bugfix.rst b/newsfragments/8942.bugfix.rst new file mode 100644 index 00000000000..e0f4ece9f68 --- /dev/null +++ b/newsfragments/8942.bugfix.rst @@ -0,0 +1 @@ +Fix mountpoint files' date attributes on unix systems