Bug#698640: gvfs-bin: gfvs-trash can not trash on fs that is bind mounted

Christian Pernegger pernegger at gmail.com
Sat Aug 5 05:30:01 BST 2023


FWIW, the code that is responsible is in libglib2.0-0. Reasonably
recent versions will refuse to use the trash on
* mounted drives. I.e. I have a separate drive for bulk storage
mounted via fstab on a directory in my home directory, no go.
* btrfs subvolumes, even just somewhere under my home directory

Funnily enough this used to work, in fact it still does work if you
remove the checks. It'll find a location to trash to (in the root of
the mount/subvolume) just fine; and if it doesn't it errors out
elsewhere. The rationale for introducing them in the first place
escapes me, to put it politely.

It annoyed me enough that I may or may not have done the following.

Disclaimer: I do NOT know what I'm doing, use at your own risk.


--- glib2.0-2.72.4.orig/gio/glocalfile.c
+++ glib2.0-2.72.4/gio/glocalfile.c
@@ -1782,8 +1782,9 @@ ignore_trash_mount (GUnixMountEntry *mou
   const gchar *mount_options;
   gboolean retval = TRUE;

-  if (g_unix_mount_is_system_internal (mount))
-    return TRUE;
+  // allow trash on mounted drives again
+  //  if (g_unix_mount_is_system_internal (mount))
+  //    return TRUE;

   mount_options = g_unix_mount_get_options (mount);
   if (mount_options == NULL)
@@ -1807,7 +1808,10 @@ static gboolean
 ignore_trash_path (const gchar *topdir)
 {
   GUnixMountEntry *mount;
-  gboolean retval = TRUE;
+
+  // allow trash on subvolumes again
+  //  gboolean retval = TRUE;
+  gboolean retval = FALSE;

   mount = g_unix_mount_at (topdir, NULL);
   if (mount == NULL)

Cheers,
Christian



More information about the pkg-gnome-maintainers mailing list