https://bugs.kde.org/show_bug.cgi?id=501802

[email protected] changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |[email protected]

--- Comment #4 from [email protected] ---
This bug is still present as of current kio master (d913ed09) and
plasma-desktop master (691b1187).

The root cause is that kio's KRecentDocument needs an (undocumented?) setting
"[RecentDocuments] UseRecent=false" to stop writing to recently-used.xbel (see:
https://invent.kde.org/frameworks/kio/-/blob/d913ed0900a5304928fc5a32c40f00e01f3f8ce4/src/core/krecentdocument.cpp#L512).
But kcm_recentFiles, with "System Settings -> Recent Files -> Remember opened
documents -> Do not remember" selected, does not set UseRecent=false at all.

(It only changes settings in kactivitymanagerd-pluginsrc (see:
https://invent.kde.org/plasma/plasma-desktop/-/blob/691b1187c82155100a56f00c9f57eddb914479b8/kcms/recentFiles/kcm_recentFiles.cpp#L165
and
https://invent.kde.org/plasma/plasma-desktop/-/blob/691b1187c82155100a56f00c9f57eddb914479b8/kcms/recentFiles/kactivitymanagerd_plugins_settings.kcfg#L6).
Unchecking "System Settings -> Activities -> Default -> While on this activity,
allow -> Tracking file and app use" doesn't help either.)

I also believe that since Plasma already sets various options for GTK, "Do not
remember" should also set either the GTK3/GTK4 setting
"gtk-recent-files-enabled=false" and the dconf setting
"org.gnome.desktop.privacy remember-recent-files false" (the latter works only
on Wayland, see:
https://gitlab.gnome.org/GNOME/gtk/-/blob/668e216846a42ca29f3c258384ed03a36875c62a/gdk/wayland/gdksettings-wayland.c#L286
and
https://gitlab.gnome.org/GNOME/gtk/-/blob/668e216846a42ca29f3c258384ed03a36875c62a/gtk/gtkrecentmanager.c#L457
and
https://gitlab.gnome.org/GNOME/glib/-/blob/303b0dff4ee52e1311c3a518fe96d0e7e55e1328/glib/gbookmarkfile.c#L2067).

---

Since this bug is not very likely to get much attention, if anyone is
interested in a comprehensive workaround until it's fixed, you need to:

1. run "kwriteconfig6 --group RecentDocuments --key UseRecent false"
(Explanation: this writes to kdeglobals and stops KRecentDocument writing to
recently-used.xbel - see the git link to kio/src/core/krecentdocument.cpp
above).

Remember that recently-used.xbel is not just a KDE thing, it's a freedesktop
spec (see:
https://www.freedesktop.org/wiki/Specifications/desktop-bookmark-spec/), so you
also need to stop it for GTK apps:

2. on Wayland, run "gsettings set org.gnome.desktop.privacy
remember-recent-files false"
(Explanation: this is enough to stop writing to recently-used.xbel for most
Wayland GTK3 and GTK4 apps, see the gtk and glib git links above). If you're
still using X apps, I haven't tested it, but setting the GTK option
"gtk-recent-files-enabled=false" should work - though be careful as KDE writes
to many gtk configs.

Note that the above may not be enough to cover all apps attempting to write to
recently-used.xbel. For good measure, you can:

3. run "rm -f ~/.local/share/recently-used.xbel && mkdir
~/.local/share/recently-used.xbel{,.lock} && touch
~/.local/share/recently-used.xbel{,.lock}/recently-used".
(Explanation: libs using this file will first write the current contents and
new data to a recently-used.xbel.XXXXXX mkstemp() file and then rename, to make
the change atomic. kio additionally uses a lock in the form of a
"recently-used.xbel.lock"" file and does not attempt to write if it can't take
that lock. See e.g.
https://invent.kde.org/frameworks/kio/-/blob/d913ed0900a5304928fc5a32c40f00e01f3f8ce4/src/core/krecentdocument.cpp#L179
and
https://gitlab.gnome.org/GNOME/glib/-/blob/303b0dff4ee52e1311c3a518fe96d0e7e55e1328/glib/gfileutils.c#L1368).

Tl;dr: these three steps should stop writes to recently-used.xbel, but there's
no guarantee at all that some app won't try to write to it - note that even
with step #3 an app may still leak data to disk, writing to a
"recently-used.xbel.XXXXXX" tempfile.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to