Subject: Re: bug#58781: 28.2; move-file-to-trash may move file across filesystems

From: Gustavo Barros <[email-masked]>
Date: Wed, 26 Oct 2022 08:05:43 -0300

Hi Stefan,

On Wed, 26 Oct 2022 at 03:22, Stefan Kangas <[email-masked]> wrote:

> Yes, that argument overlooks what happens when files are moved from
> encrypted partitions to unencrypted ones.  That is bad.

> Agreed, but I don't think this makes it into a non-bug.

Thanks for looking into this. And, particularly, for the way you
classified the report. It is my understanding too that this should be
cause for concern.

> Could you write this up as a proper patch, instead?

I don't think this snippet is a proper general solution to the
problem, except as a temporary workaround for anyone interested to
keep in their init files. I shared it in this spirit, at least. As far
as I searched, "gio" stands for "Gnome Input/Output", I presume this
is distro specific. Also, even if it was not, "gio trash" appears to
have some limitations in that some places are not supported like
"system internal mounts" (eg. "/tmp/", this is the reason for the
sentinel there), so some further handling of cases would still be
necessary.

Besides, unfortunately I cannot sign a patch (no papers), so I have to
contribute in other ways.

I'm not that well acquainted with `files.el', but as far as I've
looked into `move-file-to-trash', I think the right way to handle it
would be directly there, or in a dedicated `xdg-trash', as you
suggest. It is more complicated than the current standing but it
appears not to be overly so. It's really three cases, and then there
are the checks for "$topdir/.Trash". Anyway, I didn't seem to find any
"universal Linux way" available for the operation so, as far as I can
tell, relying on the system tools would not be a wise alternative.

Best regards,
Gustavo.