Subject: Re: bug#32413: 25.2; When run as root, emacs writes dconf files in a non-root user's /run/user/XXX directory

From: Vincent Lefevre <[email-masked]>
Date: Fri, 10 Aug 2018 16:32:03 +0200

On 2018-08-10 16:47:17 +0300, Eli Zaretskii wrote:
> That was just an example of something that doesn't explicitly ask for
> writing a file.  Another example is Eshell: when it exits, it writes
> files in the ~/.eshell directory.

If you mean that it writes the history, then that's a usual shell
thing, so that's OK. BTW, that's probably one of the reasons why
"su" redefines HOME to the target user home directory by default.

I suppose that caches could be OK too as long as they are written
in a "safe" place.

> More generally, certain Emacs features might write files "without user
> explicitly asking" as part of providing some feature that needs to be
> persistent between sessions.  I think that's quite allright, which is
> why I disagree with the general principle you were trying to
> establish.

Perhaps.

But, for instance, writing a default .emacs would not be OK and would
require at least user confirmation.

> > And if the user introduces some customization, then this can be
> > regarded as an explicit write operation (due to the action of the
> > user in this sense).
> 
> Well, in that case, let's regard user using dconf as an explicit write
> permission ;-)
> 
> Seriously, though: if your principle can be subverted in some
> situations, then we need to define what situations are those.  In
> particular, how is what you report different from what Eshell does on
> exit?

So, perhaps this should be on a case by case basis. I don't know about
dconf, but in that case, this doesn't seem to be correct. And if not
writing under $HOME, I think that the owner of the directory should be
checked in some cases.

-- 
Vincent Lefèvre <[email-masked]> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)