Trash specification regarding bind mounts
lists.ban at herbesfolles.org
Tue Sep 23 09:08:12 PDT 2014
As this bug report shows, the trash handling in GNOME is buggy on
bind mounts, because the behavior of GIO and GVFS is inconsistent:
GIO (responsible for trashing files) trashes files in the topmost parent
directory on the same device as the file to trash, where GVFS
(responsible for listing the trash contents) only looks for trashes in
non-internal non-bind mounts. This leads to disappearing trashed files.
It was suggested by GLib developer Ryan Lortie that "the spec should
probably be made a bit more clear on what is expected in cases like
this. Might be worth raising this on the xdg-list to see what other
Indeed, the specification defines a "top directory" as "the directory
where a file system is mounted." In the case of bind mounts, it is
arguable that the mount point is not "a file system mount point" as it
may not be the only mount for this file system nor mount a file system
root. It would be good if the specification had a definition that could
apply unambiguously to bind mounts as well.
So how do you think trash should behave on bind mounts?
We have gathered basically three possible behavior in such cases:
1. Trash at the mount location, regardless of the file system root. This
is what GIO's g_file_trash() currently does.
2. Trash at the file system root. This has implementation issues, like
that a rename generally doesn't pass mount boundaries and trashing may
then involve a copy. Likewise, the file system root may not be
accessible for writing for an user even when the bind mount is.
3. Do not support trashing in such cases. This seems to currently be the
preferred behavior for GIO maintainers.
In my opinion, the expected behavior from an user point of view would be
to follow solution 1 and trash at the mount location, regardless of
whether it is a file system root or a bind mount.
Thanks in advance for your advice,
More information about the xdg