From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: Questions about XDG_RUNTIME_DIR and server-socket-dir Date: Sun, 03 Feb 2019 08:01:14 +0200 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="262053"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: K-9 Mail for Android To: emacs-devel@gnu.org, Phil Sainty , "emacs-devel@gnu.org" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Feb 03 07:10:01 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gqAye-00161D-4Y for ged-emacs-devel@m.gmane.org; Sun, 03 Feb 2019 07:10:00 +0100 Original-Received: from localhost ([127.0.0.1]:51908 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gqAyc-0003Hb-TM for ged-emacs-devel@m.gmane.org; Sun, 03 Feb 2019 01:09:58 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:56225) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gqAyS-0003EI-PK for emacs-devel@gnu.org; Sun, 03 Feb 2019 01:09:49 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:59513) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gqAqF-0008Qo-J6; Sun, 03 Feb 2019 01:01:19 -0500 Original-Received: from [176.12.202.20] (port=51534 helo=[10.164.143.235]) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1gqAqE-0003Q4-Tr; Sun, 03 Feb 2019 01:01:19 -0500 In-Reply-To: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:232923 Archived-At: On February 3, 2019 7:21:37 AM GMT+02:00, Phil Sainty wrote: > 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=2E >=20 > 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=3DNAME 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=2E >=20 > 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=2E >=20 > With the new behaviour, the socket filenames are all in a common > directory, and so unless a distinct server-name is specified, > conflicts occur=2E >=20 > XDG_RUNTIME_DIR is completely new to me, so I'm uncertain how I should > fix this=2E >=20 > 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=2E Does that get > used in ways that rely upon its path never changing? >=20 > 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? >=20 > NEWS says that: >=20 > > *** 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=2E > > To get the old, less-secure behavior, you can set the > > EMACS_SOCKET_NAME environment variable to an appropriate value=2E >=20 > It appears to me that *only* emacsclient respects the > EMACS_SOCKET_NAME > environment variable=2E Emacs itself ignores it when establishing the > socket, as far as I can see=2E (This is a current bug?) >=20 > 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=3Dfoo would be looking for foo in the default location, > even if EMACS_SOCKET_NAME specified a directory=2E >=20 > Can we perhaps introduce an EMACS_SOCKET_DIR environment variable > which is respected by both emacs and emacsclient? >=20 >=20 > -Phil The value of server-name can include leading directories, so I think you c= an already have what you want=2E Right?