From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Pedro Andres Aranda Gutierrez Newsgroups: gmane.emacs.devel Subject: Re: emacsclient startup messages Date: Sat, 6 Nov 2021 12:35:14 +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: multipart/alternative; boundary="000000000000d1b19305d01d2866" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="9102"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Jim Porter , Eli Zaretskii , emacs-devel To: Ulrich Mueller Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Nov 06 12:36:34 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 1mjJzu-00029z-5W for ged-emacs-devel@m.gmane-mx.org; Sat, 06 Nov 2021 12:36:34 +0100 Original-Received: from localhost ([::1]:54856 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mjJzs-000868-Px for ged-emacs-devel@m.gmane-mx.org; Sat, 06 Nov 2021 07:36:33 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:35326) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mjJz9-0007Kl-Qi for emacs-devel@gnu.org; Sat, 06 Nov 2021 07:35:47 -0400 Original-Received: from mail-lf1-x129.google.com ([2a00:1450:4864:20::129]:45007) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mjJz6-0000Y5-Nd; Sat, 06 Nov 2021 07:35:47 -0400 Original-Received: by mail-lf1-x129.google.com with SMTP id y26so24196512lfa.11; Sat, 06 Nov 2021 04:35:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=daF7LV1b+PXcVto4WgEBBunsMR3uIeVvs0G311VgKPA=; b=OZ/7RDBuSj/DIzi+4ImypA0r9SQr1InFHh55qkuKs++d9gGFsQ0Gi6WvGbtaFJ7E2u GL6v9VslpoXAIVR867KlpaPNEy+Jx83V6fbIkJwhJ9sINGa+9rrWUs3PjVlkEqUt8Tv8 gUpUQvsUkHDd/681LgrMcTjS2jBWlIJFe0px9SLN+HaEoQ/s+k7b90+iF2FsIvRM+KVh bvr6Owq1UJffEkG28ndksSXSmLfEzu4y4p7UESlTgZssm5wS0A+cLmNqv8m22xSija9h fpxYEdpyVGCQ2/RqO2UztucegLIhWFsjWfBkJ+/8Tdu0jlNTuiOPeJFl59HDDeKQ3hU9 xH1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=daF7LV1b+PXcVto4WgEBBunsMR3uIeVvs0G311VgKPA=; b=mScq1zdirCbUBnH0eHVx4fuKuh5c2RgDXvmYKuKdsShXdmC4JLAedeWAD7zrADr+8h RM1/8lO93BSkfcAqGRwd7wjCG6ktMLjdkzQ75/jQbJwbEpw2rXY2R3FJG+No6sY8Fcii kW178wJ2rhBZe5RJ+89ir7lXBBQQNmz578P8BQewNSiCI+F7/4/GhSISzqKxuE3nqfly P0iTmqeF65XCJrzh1RFPjBQN0XDJUXECkti2mPfetQ98Ag6ju4MHOHXZAYs5y4Nxybsw lbdGQWB83wHrMsHED9li5JzdEO+SM8xLgLuA5bTHkvk8dmQK0yg+YwDkN4KxCzPpydFz 3GSQ== X-Gm-Message-State: AOAM5319XynAYuJ8UE7sMCNwrxPjOfhoX1CYJnxJhsI1rPAOzXo6Sk0H 97bOPHu10/EvcTpBsO5qFgc/CXdIdvXTsCq004A= X-Google-Smtp-Source: ABdhPJzKO2ykgyCTRQ2re7ixVmuDVEa/pi4+7s2V0kSPkX+eY9CF8car9mIwKuflNoUy0eZO9JNb5cko0UsJhszFjcM= X-Received: by 2002:a05:6512:1594:: with SMTP id bp20mr42403689lfb.145.1636198541011; Sat, 06 Nov 2021 04:35:41 -0700 (PDT) In-Reply-To: Received-SPF: pass client-ip=2a00:1450:4864:20::129; envelope-from=paaguti@gmail.com; helo=mail-lf1-x129.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=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:278859 Archived-At: --000000000000d1b19305d01d2866 Content-Type: text/plain; charset="UTF-8" I remember the controversy with emacs as daemon, emacsclients and friends... hmmm... from a user's perspective I really don't know what I gain by having emacs running as a daemon if I boot up my laptop to say watch a film or listen to a recording from my satellite PVR just for the fun of it. Maybe this sounds like a very old user or a very old and very bad habit (mea maxima culpa) but when I want to edit, I write emacs or emacslient on my CLI or click on the emacs icon or drag-and-drop a file on the emacs icon and then emacs stays alive as long as I want it to stay alive. Because, yes, I do watch films and that is somehow not very compatible with writing (code or whatever). Or am I too monotask? ;-) Best, /PA On Fri, 5 Nov 2021 at 18:52, Ulrich Mueller wrote: > >>>>> 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. > -- Fragen sind nicht da um beantwortet zu werden, Fragen sind da um gestellt zu werden Georg Kreisler --000000000000d1b19305d01d2866 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
I remember the controversy with emacs as daemon, emac= sclients and friends...

hmmm... from a user&#= 39;s perspective I really don't know what I gain by having emacs runnin= g as a daemon if I boot up my laptop to say watch a film or listen to a rec= ording from my satellite PVR just for the fun of it.

Maybe this sounds like a very old user or a very old and very bad ha= bit (mea maxima culpa) but when I want to edit, I write emacs or emacslient= on my CLI or click on the emacs icon or drag-and-drop a file on the emacs = icon and then emacs stays alive as long as I want it to stay alive. Because= , yes, I do watch films and that is somehow not very compatible with writin= g (code or whatever). Or am I too monotask? ;-)

Best, /PA

On Fri, 5 Nov 2021 at 18:52, Ulrich Mueller <ulm@gentoo.org> wrote:
>>>>> On Fri, 05 N= ov 2021, Jim Porter wrote:

> On 11/5/2021 2:40 AM, Ulrich Mueller wrote:
>> $ emacsclient -t --alternate-editor=3D
>> emacsclient: can't find socket; have you started the server? >> emacsclient: To start the server in Emacs, type "M-x server-s= tart".
>> 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= =3D'
> 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= 9;
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://spec= ifications.freedesktop.org/basedir-spec/basedir-spec-latest.html#variables<= /a>

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 <
https://debbugs.gnu.org/cgi/bugrepor= t.cgi?bug=3D33847#100>:

| 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
=C2=A0 on any given host. The socket itself is local; there is no sharing =C2=A0 across hosts. Therefore I believe that creating a single socket woul= d
=C2=A0 be enough.

- Flaky NFS shouldn't be a problem, because once the communication is =C2=A0 established, the filesystem is no longer involved in it. (Of course,=
=C2=A0 there may be NFS problems at the time of startup, but then again, =C2=A0 Emacs cannot read the user's local config either.)

- A stale socket will just use a single inode, and can be reused the
=C2=A0 next time the server is started.


--
Fragen sin= d nicht da um beantwortet zu werden,
Fragen sind da um gestellt zu= werden
Georg Kreisler
--000000000000d1b19305d01d2866--