[gnome-settings-daemon/benzea/gsd-housekeeping: 3/4] housekeeping: Disable temporary file deletion on systemd



commit 7b421d7adea69544dc165ebfd5ca2369095865bd
Author: Benjamin Berg <bberg redhat com>
Date:   Thu Feb 20 15:56:39 2020 +0100

    housekeeping: Disable temporary file deletion on systemd
    
    We should probably remove this feature completely, however, for now just
    disable it as systemd does a better job at this already.

 plugins/housekeeping/gsd-disk-space.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
---
diff --git a/plugins/housekeeping/gsd-disk-space.c b/plugins/housekeeping/gsd-disk-space.c
index bd3437e5..87c130af 100644
--- a/plugins/housekeeping/gsd-disk-space.c
+++ b/plugins/housekeeping/gsd-disk-space.c
@@ -467,6 +467,20 @@ gsd_ldsm_purge_temp_files (GDateTime *old)
         DeleteData *data;
         GFile *file;
 
+        /* Never clean temporary files on a sane (i.e. systemd managed)
+         * system. In that case systemd already ships
+         *   /usr/lib/tmpfiles.d/tmp.conf
+         * which does the trick in a much safer way.
+         * Ideally we can just drop this feature, I am not sure why it was
+         * added in the first place though, it does not really seem like a
+         * privacy feature (also, it was late in the release cycle).
+         *   https://en.wikipedia.org/wiki/Wikipedia:Chesterton%27s_fence
+         *
+         * This does the same as sd_booted without needing libsystemd.
+         */
+        if (g_file_test ("/run/systemd/system/", G_FILE_TEST_IS_DIR))
+                return;
+
         file = g_file_new_for_path (g_get_tmp_dir ());
         data = delete_data_new (file, NULL, old, FALSE, FALSE, 0);
         delete_recursively_by_age (data);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]