Bug 14715 - Feature Suggestion: XDG Trash Compatibility for VFS_Recycle Backend
Summary: Feature Suggestion: XDG Trash Compatibility for VFS_Recycle Backend
Status: NEW
Alias: None
Product: Samba 4.1 and newer
Classification: Unclassified
Component: VFS Modules (show other bugs)
Version: unspecified
Hardware: All Linux
: P5 enhancement (vote)
Target Milestone: ---
Assignee: Samba QA Contact
QA Contact: Samba QA Contact
Depends on:
Reported: 2021-05-25 06:45 UTC by Elsie Hupp
Modified: 2021-08-11 19:22 UTC (History)
1 user (show)

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Elsie Hupp 2021-05-25 06:45:45 UTC
Linux desktop environments such as GNOME generally follow a standardized behavior for Trash as defined in the XDG Trash specification:


The behavior of Trash as defined in the XDG Trash specification does not merely involve moving a trashed file or folder to the Trash folder; rather, each trashed file or folder includes metadata with the original path and the trashed date. Among other purposes, this metadata allows trashed files to be "put back" in their original locations and allows the Trash to automatically cull trashed files on a rolling basis.

The Samba VFS_Recycle backend (https://www.samba.org/samba/docs/current/man-html/vfs_recycle.8.html) is not compatible the XDG Trash specification. While indeed the specification explicitly notes that in its current form it does not apply to remote SMB shares:

    "Important note on scope. This specification currently does NOT 
    define trashing on remote machines where multiuser permissions are 
    implemented but the numeric user ID is not supported, like FTP 
    sites and CIFS shares. In systems implementing this specification, 
    trashing of files from such machines is to be done only to the 
    user's home trash directory (if at all). A future version may address 
    this limitation."

…if the server hosting the remote SMB share is a Linux desktop, files and folders recycled using Samba’s VFS_Recycle backend do not appear in the remote user's local Trash. Incorporating some degree of support for the XDG Trash specification on the remote server backend would make files and folders trashed over SMB behave more similarly to files and folders trashed locally on the remote server, which would be more user-friendly, at least for the remote user.

Because of the differences in behavior between VFS_Recycle and the XDG Trash specification, it may be preferable to define a separate VFS_Trash backend that would be mutually exclusive with VFS_Recycle, in order to prevent conflicts.

Additionally, of course, it would be lovely if CIFS supported some degree of frontend Trash functionality, but that is, of course, dependent on client support, which is to say it's presumably largely beyond Samba's control.

I should add that I will take a poke at this myself, but it is generally well beyond me. My plan is to start with the GVFS Trashlib (https://gitlab.gnome.org/GNOME/gvfs/-/tree/master/daemon/trashlib), and I've created a fork (https://gitlab.com/elsiehupp/samba) where I will be working.