From: Ralph Boehme Date: Tue, 1 Apr 2014 10:15:32 +0000 (+0200) Subject: Spotlight: file modification date, bug #545 X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=534d25ad6989a2aa47a67f856ce2cc23c6e1e5b7;p=netatalk.git Spotlight: file modification date, bug #545 The Spotlight module misleadingly updated a files modification date when the client requested an "kMDItemLastUsedDate" attribute update. It's questionable whether we're expected at all to map and modify attributes to filesystem metadata, but my guess is we are. As a fix, use "kMDItemFSContentChangeDate" attribute instead of "kMDItemLastUsedDate". Fixes bug #545. --- diff --git a/NEWS b/NEWS index 823f9529..997ede17 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,7 @@ Changes in 3.1.2 ================ * FIX: Option "vol dbpath" was broken in 3.1.1 +* FIX: Spotlight: file modification date, bug #545 Changes in 3.1.1 ================ diff --git a/etc/afpd/spotlight.c b/etc/afpd/spotlight.c index fff5a36b..a3fa5870 100644 --- a/etc/afpd/spotlight.c +++ b/etc/afpd/spotlight.c @@ -390,7 +390,14 @@ static int sl_rpc_storeAttributesForOIDArray(const AFPObj *obj, const DALLOC_CTX EC_NEG1_LOG( movecwd(vol, dir) ); } - if ((sl_time = dalloc_value_for_key(query, "DALLOC_CTX", 0, "DALLOC_CTX", 1, "DALLOC_CTX", 1, "kMDItemLastUsedDate"))) { + /* + * We're possibly supposed to update attributes in two places: the + * database and the filesystem. Due to the lack of documentation + * and not yet implemented database updates, we cherry pick attributes + * that seems to be candidates for updating filesystem metadata. + */ + + if ((sl_time = dalloc_value_for_key(query, "DALLOC_CTX", 0, "DALLOC_CTX", 1, "DALLOC_CTX", 1, "kMDItemFSContentChangeDate"))) { struct utimbuf utimes; utimes.actime = utimes.modtime = sl_time->tv_sec; utime(path, &utimes);