Comment # 3 on bug 1205109 from
(In reply to Zim Tsui from comment #2)
> (In reply to Dr. Werner Fink from comment #1)
> > Give the attached shell script as a replacement of /usr/bin/emacs a try and
> > report if this does work for you.
> 
> I tried that but it doesn't work.
> 
> Your substitute script simply replaces `UID` with `EUID`. This is redundant
> because `sudo` already handles that well. Try the below as regular user:
> 
> ```shell
> $ sudo sh -c "echo \$UID"
> 0
> $ sudo sh -c "echo \$EUID"
> 0
> ```

The aim is to replace XDG_RUNTIME_DIR to the correct one

> 
> The key point is that the directory `/run/user/0` doesn't exist if you have
> never logged in as root since boot.
> 
> `su -` or `sudo -i` simply emulates a login shell, but actually doesn't
> create a new session. See
> <https://github.com/systemd/systemd/issues/7451#issuecomment-346787237>
> 
> A possible solution is doing nothing about the environment. Since emacs has
> its own logic about handling the absence of environment variables, why
> interfere it?

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.

 XDG_RUNTIME_DIR (/run/user/223) is not owned by us (uid 0), but by uid 223!
(This could e.g. happen if you try to connect to a non-root PulseAudio as a
root user, over the native protocol. Don't do that.)

that is the exported XDG variables will be taken by user root.


You are receiving this mail because: