From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Ulrich Mueller Newsgroups: gmane.emacs.devel Subject: Re: emacsclient startup messages Date: Fri, 05 Nov 2021 18:52:38 +0100 Message-ID: References: <89dc096b-6c33-db5a-d2d2-b43fb92e4900@gmail.com> <074495a9-aff8-edce-f81f-51fdfc622f6e@gmail.com> <83bl2zdo4u.fsf@gnu.org> <96935ebe-8e7b-0813-1f68-c385b5377a3e@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="20492"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) Cc: Ulrich Mueller , emacs-devel@gnu.org, Eli Zaretskii , Pedro Andres Aranda Gutierrez To: Jim Porter Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Nov 05 18:53:26 2021 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mj3P3-000592-S9 for ged-emacs-devel@m.gmane-mx.org; Fri, 05 Nov 2021 18:53:25 +0100 Original-Received: from localhost ([::1]:60718 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mj3P2-0000GK-NH for ged-emacs-devel@m.gmane-mx.org; Fri, 05 Nov 2021 13:53:24 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:55978) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mj3OU-000819-Lc for emacs-devel@gnu.org; Fri, 05 Nov 2021 13:52:50 -0400 Original-Received: from dev.gentoo.org ([2001:470:ea4a:1:5054:ff:fec7:86e4]:51039 helo=smtp.gentoo.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_CHACHA20_POLY1305:256) (Exim 4.90_1) (envelope-from ) id 1mj3OR-0000iM-Ar; Fri, 05 Nov 2021 13:52:49 -0400 In-Reply-To: <96935ebe-8e7b-0813-1f68-c385b5377a3e@gmail.com> (Jim Porter's message of "Fri, 5 Nov 2021 09:35:47 -0700") Received-SPF: pass client-ip=2001:470:ea4a:1:5054:ff:fec7:86e4; envelope-from=ulm@gentoo.org; helo=smtp.gentoo.org X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 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-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:278794 Archived-At: >>>>> On Fri, 05 Nov 2021, Jim Porter wrote: > On 11/5/2021 2:40 AM, Ulrich Mueller wrote: >> $ emacsclient -t --alternate-editor= >> emacsclient: can't find socket; have you started the server? >> emacsclient: To start the server in Emacs, type "M-x server-start". >> Another Emacs daemon is already running at process id 6084 >> Error: server did not start correctly >> Error: Could not start the Emacs daemon >> $ > Why are you (or the Gentoo package) running with `--alternate-editor=' > if a daemon was already started? Because the user may not be sure if a daemon is running, and may want to start it just in case? Which fails with the patch applied. Note that the Gentoo package only starts the daemon, calling emacsclient is up to the user. I'm not keen to receive bug reports because users' workflows are being broken. (In fact, broken again, as we already had a round of that with Emacs 27). > [...] > As for my personal opinion on this, I think it would be best to revert > bug#33847 (which supports the Gentoo use-case). If necessary, we could > provide a way to explicitly opt into the (insecure) bug#33847 > behavior, e.g. by adding a --fall-back-to-tmpdir-sockets flag. I'm > also ok with my compromise patch, even though it's not perfect. Not helpful. :( The main problem with XDG_RUNTIME_DIR ist that it doesn't persist between login sessions: | The lifetime of the directory MUST be bound to the user being logged | in. It MUST be created when the user first logs in and if the user | fully logs out the directory MUST be removed. [...] Files in the | directory MUST not survive reboot or a full logout/login cycle. | | https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html#variables In contrast to that, an Emacs running as a daemon can survive logout, and the user may want to reconnect to it later. This is impossible if the socket is located in XDG_RUNTIME_DIR, which is scrapped upon logout. In bug #33847 I had suggested to create the socket in ${HOME}/emacs.d/ instead. Unfortunately this was shot down, with the arguments summarised in : | This would be worse for several reasons: you'd need to disambiguate | via hostname, you'd need to guarantee hostnames are unique, you'd have | problems when NFS is flaky or hanging in your home directory, and | you'd need to deal with socket files that survive OS crashes. I still don't think that any of these arguments is substantive: - Unix sockets use the file system just as a namespace, which is unique on any given host. The socket itself is local; there is no sharing across hosts. Therefore I believe that creating a single socket would be enough. - Flaky NFS shouldn't be a problem, because once the communication is established, the filesystem is no longer involved in it. (Of course, there may be NFS problems at the time of startup, but then again, Emacs cannot read the user's local config either.) - A stale socket will just use a single inode, and can be reused the next time the server is started.