[PATCH] Do not track cache partitions with freespacenotifier
authorNiccolò Venerandi <niccolo@venerandi.com>
Thu, 29 May 2025 07:25:03 +0000 (07:25 +0000)
committerAurélien COUDERC <coucouf@debian.org>
Mon, 21 Jul 2025 16:21:10 +0000 (18:21 +0200)
BUG:504423

(cherry picked from commit f4a08099d0aae466f06f0094498cc593c8ce4532)

e033ef89 Do not track cache partitions with freespacenotifier
5203019a Apply 1 suggestion(s) to 1 file(s)

Co-authored-by: Niccolò Venerandi <niccolo@venerandi.com>
Gbp-Pq: Name upstream_01978f58_Do-not-track-cache-partitions-with-freespacenotifier.patch

freespacenotifier/module.cpp

index 3d8e06c0a48ce72f42f7ace22066a35d69ae92dc..1700a3695df84fe68a02071dceb0ee6a6940eb6f 100644 (file)
@@ -19,6 +19,7 @@
 #include <Solid/StorageVolume>
 
 #include <QDir>
+#include <QFile>
 
 #include "kded_interface.h"
 
@@ -74,7 +75,11 @@ void FreeSpaceNotifierModule::onNewSolidDevice(const QString &udi)
     if (auto generic = device.as<Solid::GenericInterface>()) {
         isReadOnly = generic->property(QStringLiteral("ReadOnly")).toBool();
     }
-    if (isReadOnly) {
+    // Cache devices should be marked through a
+    // CACHEDIR.TAG file to avoid indexing; see
+    // https://bford.info/cachedir/ for reference.
+    const bool isCache = QFile::exists(QDir(access->filePath()).filePath(QStringLiteral("CACHEDIR.TAG")));
+    if (isReadOnly || isCache) {
         return;
     }