unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Jim Porter <jporterbugs@gmail.com>
To: Ulrich Mueller <ulm@gentoo.org>
Cc: Pedro Andres Aranda Gutierrez <paaguti@gmail.com>,
	emacs-devel <emacs-devel@gnu.org>
Subject: Re: emacsclient startup messages
Date: Sat, 30 Oct 2021 12:16:55 -0700	[thread overview]
Message-ID: <d6f8ea4b-5f99-68fd-1b0a-03a1a97da0b5@gmail.com> (raw)
In-Reply-To: <umtmq5s4i@gentoo.org>

On 10/30/2021 10:39 AM, Ulrich Mueller wrote:
>>>>>> On Tue, 26 Oct 2021, Jim Porter wrote:
> 
>> I believe this is bug#51327. From how I understand it, this is fallout
>> from the fix for bug#33847 that occurs when `emacsclient' is run and
>> can't find a daemon to connect to. As far as I can tell, it's an
>> indicator of a real bug: the code is checking TMPDIR for the socket
>> even on a system with XDG_RUNTIME_DIR set (and ultimately, the
>> to-be-created daemon will put its socket in XDG_RUNTIME_DIR).
> 
> There can be situations where there is an XDG environment for the client
> but not for the daemon.

Right, the patch in bug#33847 should handle that case correctly, but I'm 
pretty sure the current implementation opens users who spawn the Emacs 
daemon on-demand to symlink attacks. That's due to the code needing to 
check both XDG_RUNTIME_DIR and TMPDIR before being sure there's no 
daemon to connect to.

I can think of two ways to avoid this issue:

1) Have a flag that lets users explicitly state whether emacsclient can 
fall back to looking in TMPDIR. Then, if the flag is unset, emacsclient 
will only look in XDG_RUNTIME_DIR; if it is set, it will look in 
XDG_RUNTIME_DIR first, and fall back to TMPDIR if necessary. However, 
this means that either your case in bug#33847 or the "daemon on demand" 
case will need to explicitly set this flag, which is annoying.

2) If XDG_RUNTIME_DIR and ALTERNATE_EDITOR/--alternate-editor are both 
set, never check TMPDIR. This should let both cases work without 
requiring users to explicitly set a flag anywhere, but it the lack of 
explicitness could be more confusing. I think this should work fine in 
all cases, since users running `emacs --daemon' without XDG probably 
won't be using ALTERNATE_EDITOR (the daemon should always be running, so 
there's no need for an alternate editor).

- Jim



  reply	other threads:[~2021-10-30 19:16 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-26  5:26 emacsclient startup messages Pedro Andres Aranda Gutierrez
2021-10-26 12:18 ` Eli Zaretskii
2021-10-26 16:43   ` Pedro Andres Aranda Gutierrez
2021-10-26 16:32 ` Jim Porter
2021-10-26 16:46   ` Pedro Andres Aranda Gutierrez
2021-10-26 17:03     ` Jim Porter
2021-10-27  5:05       ` Pedro Andres Aranda Gutierrez
2021-10-30 17:39   ` Ulrich Mueller
2021-10-30 19:16     ` Jim Porter [this message]
2021-10-30 19:47       ` Jim Porter
2021-10-31 10:03         ` Pedro Andres Aranda Gutierrez
2021-10-31 15:44           ` Pedro Andres Aranda Gutierrez
2021-11-05  7:04             ` Pedro Andres Aranda Gutierrez
2021-11-05  8:04               ` Eli Zaretskii
2021-11-05  9:40                 ` Ulrich Mueller
2021-11-05 16:35                   ` Jim Porter
2021-11-05 17:52                     ` Ulrich Mueller
2021-11-06 11:35                       ` Pedro Andres Aranda Gutierrez
2021-11-06 18:40                         ` Jim Porter
2021-11-07  9:49                       ` Peter Oliver

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d6f8ea4b-5f99-68fd-1b0a-03a1a97da0b5@gmail.com \
    --to=jporterbugs@gmail.com \
    --cc=emacs-devel@gnu.org \
    --cc=paaguti@gmail.com \
    --cc=ulm@gentoo.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 public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).