From: Phil Sainty <psainty@orcon.net.nz>
To: "emacs-devel@gnu.org" <emacs-devel@gnu.org>
Subject: Questions about XDG_RUNTIME_DIR and server-socket-dir
Date: Sun, 3 Feb 2019 18:21:37 +1300 [thread overview]
Message-ID: <dac832f4-39cb-bb8f-cb79-631b502a0a9b@orcon.net.nz> (raw)
The recent change to server-socket-dir to use the XDG_RUNTIME_DIR
environment variable is breaking some of my tooling, so I want to
understand the matter better.
The essence of my issue is that, via my wrapper script, a user can
run multiple independent Emacs instances, including running multiple
Emacs servers, and it's necessary that I'm not depending on
--daemon=NAME to differentiate the server sockets in this situation,
because the user should be able to specify any arbitrary options,
and should be able to have a non-server instance call (server-start)
to create a new non-conflicting server with the default server-name.
At present I automatically establish a distinct TMPDIR for each
instance, and until Emacs 27 this has worked well: server-socket-dir
was relative to TMPDIR, and so it didn't matter whether multiple
servers had a common server-name, as the sockets themselves were in
different directories.
With the new behaviour, the socket filenames are all in a common
directory, and so unless a distinct server-name is specified,
conflicts occur.
XDG_RUNTIME_DIR is completely new to me, so I'm uncertain how I should
fix this.
I can, of course, create a temporary XDG_RUNTIME_DIR the same way that
I create a temporary TMPDIR (the new dir is a sub-dir of the original
dir), which would deal with the conflicts; but as such a change is
reflected in process-environment inside Emacs, any processes that
Emacs creates will see the modified XDG_RUNTIME_DIR too, and maybe
that's not ok? I'm relatively comfortable with this being the case
for TMPDIR, but I don't know about XDG_RUNTIME_DIR. Does that get
used in ways that rely upon its path never changing?
If it's not safe to change it, then I think I need a way to specify
the server-socket-dir via some new environment variable?
NEWS says that:
> *** Emacs and emacsclient now default to $XDG_RUNTIME_DIR/emacs
> as the directory for client/server sockets, if Emacs is running
> under an X Window System desktop that sets the XDG_RUNTIME_DIR
> environment variable to indicate where session sockets should go.
> To get the old, less-secure behavior, you can set the
> EMACS_SOCKET_NAME environment variable to an appropriate value.
It appears to me that *only* emacsclient respects the EMACS_SOCKET_NAME
environment variable. Emacs itself ignores it when establishing the
socket, as far as I can see. (This is a current bug?)
I think EMACS_SOCKET_NAME is, in any case, not suited for my purposes,
as it represents a combination of server-socket-dir and server-name,
and the emacsclient option --socket-name overrides it such that
--socket-name=foo would be looking for foo in the default location,
even if EMACS_SOCKET_NAME specified a directory.
Can we perhaps introduce an EMACS_SOCKET_DIR environment variable
which is respected by both emacs and emacsclient?
-Phil
next reply other threads:[~2019-02-03 5:21 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-03 5:21 Phil Sainty [this message]
2019-02-03 6:01 ` Questions about XDG_RUNTIME_DIR and server-socket-dir Eli Zaretskii
2019-02-03 9:18 ` Phil Sainty
2019-02-03 11:21 ` Eli Zaretskii
2019-02-03 21:12 ` Phil Sainty
2019-02-04 3:30 ` Eli Zaretskii
2019-02-04 4:10 ` Stefan Monnier
2019-02-04 5:06 ` Phil Sainty
2019-02-03 6:10 ` Paul Eggert
2019-02-03 8:41 ` Phil Sainty
2019-02-03 16:42 ` Paul Eggert
2019-02-04 12:49 ` Ulrich Mueller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=dac832f4-39cb-bb8f-cb79-631b502a0a9b@orcon.net.nz \
--to=psainty@orcon.net.nz \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.