Skip to content

Spotlight: Revert some changes to timestamps#2896

Open
NJRoadfan wants to merge 1 commit intoNetatalk:mainfrom
NJRoadfan:partial-revert-spotlight-fixes
Open

Spotlight: Revert some changes to timestamps#2896
NJRoadfan wants to merge 1 commit intoNetatalk:mainfrom
NJRoadfan:partial-revert-spotlight-fixes

Conversation

@NJRoadfan
Copy link
Copy Markdown
Contributor

No description provided.

@NJRoadfan NJRoadfan requested a review from rdmark as a code owner April 18, 2026 18:44
@augmentcode
Copy link
Copy Markdown

augmentcode bot commented Apr 18, 2026

🤖 Augment PR Summary

Summary: This PR rolls back Spotlight timestamp updates by removing the code path that applied kMDItemLastUsedDate to filesystem timestamps.

Changes:

  • Drops the kMDItemLastUsedDate handling in sl_rpc_storeAttributesForOIDArray(), leaving only the kMDItemFSContentChangeDate-based update.

🤖 Was this summary useful? React with 👍 or 👎

Copy link
Copy Markdown

@augmentcode augmentcode bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review completed. No suggestions at this time.

Comment augment review to trigger a new review at any time.

@NJRoadfan
Copy link
Copy Markdown
Contributor Author

Unless a stat() call is made to retrieve a file's mtime beforehand, you can't update just the atime with utime(), hence the error with the mtime being reset everytime the client sends kMDItemLastUsedDate back to the server. We don't want to needlessly trigger a stat() call each time a file is accessed, so this revert will have to do for now. Note that some OSes, such as Linux mount their filesystems with the relatime option which won't update the atime of a file on each actual access to lower overhead, so the "Last Accessed" time in Finder won't always be accurate.

@rdmark
Copy link
Copy Markdown
Member

rdmark commented Apr 18, 2026

@NJRoadfan can you take a look at this PR that might address the issue without reverting -- #2897

this resolves the issue I was seeing (host is Linux, client is macOS)

do you see any reason why calling utimensat() every time here would be a bad idea?

@NJRoadfan
Copy link
Copy Markdown
Contributor Author

It should be fine for this use. Is utimensat() available on all platforms? I'm seeing references that older macOS (<10.13) don't support it and the call isn't used anywhere else in the Netatalk code base.

@rdmark
Copy link
Copy Markdown
Member

rdmark commented Apr 18, 2026

utimensat is POSIX 1-2008 and contemporaneous with other at-functions that we rely on

my second internalized justification was that the Spotlight stack (Localsearch or recent Tracker etc) is unlikely to be usable on older OSes anyways, so they won't be compiling this code

that said a capability check for utimensat with a portable fallback is definitely the more prudent solution

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants