Subject: Re: bug#60460: 30.0.50; [FR] avoid putting remote files to local trash

From: Michael Albinus <[email-masked]>
Date: Tue, 03 Jan 2023 09:47:42 +0100

Jean Louis <[email-masked]> writes:

Hi Jean,

> Those are decisions of administrator and user. Permissions they put on
> files is their decision and freedom.
>
> Any file owned by root and moved to user's home directory somewhere in
> the Trash, will have how I tested it, same permission as in root
> accessible directories. Let us say /etc or /usr and so on, those files
> are anyway either visible by users or some of them in /etc protected
> by permissions. Those are system decisions.
>
> Who has sudo rights is system administrator, not necessarily main, but
> then those people made decisions.
>
> And moving into trash is useful, especially in case of files in /etc
>
> Let administrators decide what they want.
>
> Emacs is high level interface, not low level. On high level there is
> almost nothing to be decided what people decided on low level.
>
> For me is not logical to try to prevent people what they want.
>
> Give them option, but don't try preventing them on that high level to
> do this or that, what they otherwise can do in their system by using
> different file manager.
>
> If I can run other file manager with sudo and move to Trash anywhere
> it is specified, then let it be for Emacs users too, as by trying to
> "secure" something what otherwise was decided on low level, makes no
> sense.
>
> We can't say later "Emacs is more secure as file manager because it
> does not allow you to move files managed with sudo to Trash" --
> because it is not "more secure" as it is high level, not low level.

All true, but there are individual decisions by users. I don't see why
we shall add a special case for sudo (and su, doas, sudoedit, sg, ...) -
all of them identify remote (possibly root owned) files and shall be
handled as such. And then, there are also multi-hop remote file names,
which would need another handling then for sudo and friends.

`remote-file-name-inhibit-delete-by-moving-to-trash' is just an offer as
convenience user option, nobody is obliged to use it. There are still
connection-local variables or `system-move-file-to-trash' for users with
the need of more fine-grained configuration.

> Right now I use my function `system-move-file-to-trash' as recommended
> by function `move-file-to-trash' and that is great option, I like that
> configuration, so I can decide myself what get moved to Trash and what
> not, so I will expand it to recognize sudo paths.

Sigh.

Best regards, Michael.