Comment # 5 on bug 1205109 from
(In reply to Zim Tsui from comment #4)
> (In reply to Dr. Werner Fink from comment #3)
> > just try 
> > 
> >    sudo /usr/bin/emacs-nox
> > 
> > and then try with installed emacs-x11
> > 
> >    sudo /usr/bin/emacs-gtk
> > 
> > and see what happens ... I see e.g.
> 
> If I run `sudo emacs-nox` directly, no errors occurred.

I've asked for emacs-gtk not for emacs-nox, please install the package
emacs-x11 and then retry with 

  EMACS_TOOLKIT=gtk sudo emacs

> 
> Only if I run `sudo emacs`, it prints errors.
> 
> This is because the script `/usr/bin/emacs` set the variable
> `XDG_RUNTIME_DIR` to `/run/user/0` when I run `sudo emacs`, while the
> directory `/run/user/0` doesn't exist.
> 
> The reason why `/run/user/0` doesn't exist is that `sudo` doesn't create a
> new real session to login as root(UID:0), it merely SIMULATES a login shell.
> The systemd is not aware of someone loging in as root, and will not create
> the directory `/run/user/0`.

I'm aware of, nevertheless the question is how to solve the problem for the
most emacs users out there. And the x11/gtk version of GNU Emacs is with dbus
support.  And this script exists e.g. for ssh connections.

> 
> > The aim is to replace XDG_RUNTIME_DIR to the correct one
> 
> The variable `XDG_RUNTIME_DIR` should be managed only by systemd rather than
> by user scripts, because only systemd knows what to do else with the
> variable, such as creating the corresponding directories. It's dangerous to
> set the XDG_ variables manually.

This managment does currently not happen.

> 
> The simplist solution to this issue is not to set the XDG variables in
> `/usr/bin/emacs`, as if the variables are not set when `emacs-nox` is run
> directly.

That is a corner case ... I'm interested to solve it also for emacs with dbus
support.


You are receiving this mail because: