]> arthur.barton.de Git - netatalk.git/commitdiff
Spotlight: file modification date, bug #545
authorRalph Boehme <rb@sernet.de>
Tue, 1 Apr 2014 10:15:32 +0000 (12:15 +0200)
committerRalph Boehme <rb@sernet.de>
Tue, 1 Apr 2014 10:21:19 +0000 (12:21 +0200)
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.

NEWS
etc/afpd/spotlight.c

diff --git a/NEWS b/NEWS
index 823f9529f0cdbed4dd9128c10e644c0e69f09f94..997ede1706d3df88cde195e375cf62212f8a82e2 100644 (file)
--- 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
 ================
index fff5a36ba244def42fed80134ae2664b603cfbd9..a3fa587068b3ed6f699844e050c1793bd336c411 100644 (file)
@@ -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);