Skip to content

Commit

Permalink
Fix #8942: Fix the ctime of files set to the created time instead…
Browse files Browse the repository at this point in the history
… of the `updated` time.
  • Loading branch information
FirelightFlagboy committed Jan 22, 2025
1 parent 41e5c7e commit e555954
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
6 changes: 4 additions & 2 deletions libparsec/crates/platform_mountpoint/src/unix/filesystem.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<EntryName> {
Expand All @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions newsfragments/8942.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix mountpoint files' date attributes on unix systems

0 comments on commit e555954

Please sign in to comment.