netatalk icon indicating copy to clipboard operation
netatalk copied to clipboard

Support ctime and atime

Open haihige opened this issue 6 months ago • 4 comments

Is your feature request related to a problem? Please describe.

Clients are only shown the mtime (not sure if this is technically correct, but it's usually the closest to "Created" in Finder) for a file, and it is displayed for a file's ctime ("Modified") and atime ("Last opened") as well.

Describe the solution you'd like

ctime and atime to be displayed to the client, as the server can read them fine.

Describe alternatives you've considered

To verify that the ctime and atime work on AFP, I tested sharing a directory on a Mac running Snow Leopard. These dates display and update fine on the client side when shared natively from a Mac, but I'm running netatalk4 on FreeBSD for my AFP server.

Additional context

My ZFS pool and datasets and configured with atime=on, and I can see on the server (using ls -u) that the atime is updated appropriately after a file is opened, but it is never displayed for the client.

When working through files sequentially, I use the "Last opened" time in Finder to know which file I looked at last in a directory.

haihige avatar Jul 02 '25 17:07 haihige

I can acknowledge that atime clearly isn't supported at the moment (no references in code etc.) but I think ctime should work. Aren't you seeing accurate "Modified" timestamps in the Finder for files on netatalk volumes?

This is when running netatalk on Debian and macOS hosts.

Anyways, I'm happy to look into what it would take to support atime. On macOS it seems we have to look at the com.apple.metadata:kMDItemLastUsedDate xattr.

rdmark avatar Jul 10 '25 19:07 rdmark

I think this is because Netatalk maintains its own file access/modified/created date metadata within the AppleDouble EAs. Opening a file via a Netatalk share should update the "Last Opened" time, but doing it on the server side won't trigger an update to the date stored in the EA.

NJRoadfan avatar Jul 11 '25 03:07 NJRoadfan

@NJRoadfan In my experimentation, when using the latest macOS Sequoia AFP client with netatalk4 (Debian), the Last opened metadata is never updated unless you also modify the file, at which time both Last opened and Modified are set to the same time stamp.

So it seems to have a bug here.

rdmark avatar Jul 11 '25 12:07 rdmark

Aren't you seeing accurate "Modified" timestamps in the Finder for files on netatalk volumes?

Not on my end with the client. Here's what I see on the server:

$ ls -l
-rwxrwxr-x  1 haihige haihige 326868910 Nov 30  2023
$ ls -lc
-rwxrwxr-x  1 haihige haihige 326868910 Jul 10 20:56
$ ls -lu
-rwxrwxr-x  1 haihige haihige 326868910 Jul 12 09:07

On the client:

Image

Not sure if this is connected:

  • Changed reporting of file times. Files that are written from Unix now update the Mac's idea of the files modification time. Unix mtime is now reported instead of ctime.

haihige avatar Jul 12 '25 14:07 haihige