[PR #2001] [MERGED] Set mtime/ctime/atime of all objects as nanosecond #2295

Closed
opened 2026-03-04 02:04:47 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/s3fs-fuse/s3fs-fuse/pull/2001
Author: @ggtakec
Created: 7/25/2022
Status: Merged
Merged: 7/28/2022
Merged by: @gaul

Base: masterHead: fix_stattime_nanosec


📝 Commits (1)

  • 8129ea6 Set mtime/ctime/atime of all objects as nanosecond

📊 Changes

12 files changed (+404 additions, -172 deletions)

View changed files

📝 src/cache.cpp (+3 -21)
📝 src/fdcache.cpp (+5 -5)
📝 src/fdcache.h (+1 -1)
📝 src/fdcache_auto.cpp (+2 -2)
📝 src/fdcache_auto.h (+1 -1)
📝 src/fdcache_entity.cpp (+69 -57)
📝 src/fdcache_entity.h (+1 -1)
📝 src/s3fs.cpp (+151 -78)
📝 src/s3fs_util.cpp (+123 -0)
📝 src/s3fs_util.h (+18 -0)
📝 src/string_util.cpp (+2 -1)
📝 test/integration-test-main.sh (+28 -5)

📄 Description

Relevant Issue (if applicable)

#2000

Details

Changed the stat time of the object for testing in #2000 to nanosecond units.
However, there was a part where the time of some objects(directories) created/modified by s3fs remained time_t/timeval unit.
Some tests could fail instability because of using time as second/usec units.

This PR code changed them to nanosecond units.
As a result, mtime/ctime/atime of all objects created and modified by s3fs are set in nanosecond units.
With the fix, I prepared some common utility functions and decided to use them.

NOTE

On macos10, we have detected that test_mtime_file fails.
The reason is that when copying a file with cp -p, the mtime argument of the s3fs_utimens call should pass the mtime of the original file if it is in the correct state, but this value was different.
In macos10, this mtime is rounded down to microseconds instead of nanoseconds.
I could not know how to fix this.(in the first place, it is hard to think that it can be fixed with s3fs)
Therefore, I changed the test_mtime_file test result scrutiny only slightly for macos.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/s3fs-fuse/s3fs-fuse/pull/2001 **Author:** [@ggtakec](https://github.com/ggtakec) **Created:** 7/25/2022 **Status:** ✅ Merged **Merged:** 7/28/2022 **Merged by:** [@gaul](https://github.com/gaul) **Base:** `master` ← **Head:** `fix_stattime_nanosec` --- ### 📝 Commits (1) - [`8129ea6`](https://github.com/s3fs-fuse/s3fs-fuse/commit/8129ea6cac834df92b40e39be13b6bee713bb9ac) Set mtime/ctime/atime of all objects as nanosecond ### 📊 Changes **12 files changed** (+404 additions, -172 deletions) <details> <summary>View changed files</summary> 📝 `src/cache.cpp` (+3 -21) 📝 `src/fdcache.cpp` (+5 -5) 📝 `src/fdcache.h` (+1 -1) 📝 `src/fdcache_auto.cpp` (+2 -2) 📝 `src/fdcache_auto.h` (+1 -1) 📝 `src/fdcache_entity.cpp` (+69 -57) 📝 `src/fdcache_entity.h` (+1 -1) 📝 `src/s3fs.cpp` (+151 -78) 📝 `src/s3fs_util.cpp` (+123 -0) 📝 `src/s3fs_util.h` (+18 -0) 📝 `src/string_util.cpp` (+2 -1) 📝 `test/integration-test-main.sh` (+28 -5) </details> ### 📄 Description ### Relevant Issue (if applicable) #2000 ### Details Changed the stat time of the object for testing in #2000 to nanosecond units. However, there was a part where the time of some objects(directories) created/modified by s3fs remained time_t/timeval unit. Some tests could fail instability because of using time as second/usec units. This PR code changed them to nanosecond units. As a result, `mtime`/`ctime`/`atime` of all objects created and modified by s3fs are set in nanosecond units. With the fix, I prepared some common utility functions and decided to use them. #### NOTE On macos10, we have detected that `test_mtime_file` fails. The reason is that when copying a file with `cp -p`, the `mtime` argument of the `s3fs_utimens` call should pass the `mtime` of the original file if it is in the correct state, but this value was different. In macos10, this `mtime` is rounded down to microseconds instead of nanoseconds. I could not know how to fix this.(in the first place, it is hard to think that it can be fixed with s3fs) Therefore, I changed the `test_mtime_file` test result scrutiny only slightly for macos. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-04 02:04:47 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/s3fs-fuse#2295
No description provided.