unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Paul Eggert <eggert@cs.ucla.edu>
To: Ulrich Mueller <ulm@gentoo.org>, Stefan Kangas <stefan@marxist.se>
Cc: jporterbugs@gmail.com, 51327@debbugs.gnu.org
Subject: bug#51327: 28.0.60; emacsclient warns about XDG_RUNTIME_DIR when starting daemon on-demand
Date: Wed, 8 Dec 2021 15:44:39 -0800	[thread overview]
Message-ID: <21fa6f0f-bd1b-45da-c1d4-f5d44e3b2ffe@cs.ucla.edu> (raw)
In-Reply-To: <ubl1qlq0n@gentoo.org>

[-- Attachment #1: Type: text/plain, Size: 1489 bytes --]

On 12/8/21 13:56, Ulrich Mueller wrote:
> So, can we please think about a better solution, and not knee-jerk
> something half-baked into Emacs 28, like checking for yet another
> environment variable?

Agreed, now is not the time for significant innovation. It could be that 
any significant improvement will have to wait for Emacs 29.


> Even reverting to the Emacs 27 behaviour would be better than what has
> been suggested above: In Emacs 27, you can set EMACS_SOCKET_NAME to make
> things work.

Setting EMACS_SOCKET_NAME to an absolute file name should work just as 
well in emacs-28 as it did in Emacs 27, because in that case the code 
doesn't consult either XDG_RUNTIME_DIR or TMPDIR. So if that's an 
adequate solution, we should be able to continue with that.


> Given the goal to release Emacs 28.1 soon, I'm not sure there's time to come up with (and be confident in) a better solution for 28. In that case, I guess the available options are:
> 
> * If the security issue is considered minor enough, keep the current Emacs 28 behavior and silence the warning.

I'd rather not silence the warning as there is a real issue here 
(admittedly obscure...).


> * Otherwise, revert to the Emacs 27 behavior and come up with a better solution for Emacs 29. 

That sounds better, if the EMACS_SOCKET_NAME approach is good enough. 
Proposed patch attached. This patch attempts to be reasonably minimal vs 
what's in emacs-28 now (as opposed to cleaning up this somewhat-messy area).

[-- Attachment #2: 0001-emacsclient-takes-more-care-about-XDG_RUNTIME_DIR.patch --]
[-- Type: text/x-patch, Size: 1196 bytes --]

From 2cb6087f2b797d4ec21d27bc531998e07848797f Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Wed, 8 Dec 2021 15:37:39 -0800
Subject: [PATCH] emacsclient takes more care about XDG_RUNTIME_DIR

* lib-src/emacsclient.c (set_local_socket): Revert to the Emacs 27
behavior of not trying TMPDIR if XDG_RUNTIME_DIR is set.
This is one of the suggestions made by Jim Porter and
independently by Ulrich Mueller in Bug#51327.
---
 lib-src/emacsclient.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c
index cff3cec2a7..d11fd88c45 100644
--- a/lib-src/emacsclient.c
+++ b/lib-src/emacsclient.c
@@ -1456,7 +1456,6 @@ set_local_socket (char const *server_name)
   else
     {
       /* socket_name is a file name component.  */
-      sock_status = ENOENT;
       char const *xdg_runtime_dir = egetenv ("XDG_RUNTIME_DIR");
       if (xdg_runtime_dir)
 	{
@@ -1466,7 +1465,7 @@ set_local_socket (char const *server_name)
 			 ? connect_socket (AT_FDCWD, sockname, s, 0)
 			 : ENAMETOOLONG);
 	}
-      if (sock_status == ENOENT)
+      else
 	{
 	  char const *tmpdir = egetenv ("TMPDIR");
 	  if (tmpdir)
-- 
2.32.0


  parent reply	other threads:[~2021-12-08 23:44 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-22  4:58 bug#51327: 28.0.60; emacsclient warns about XDG_RUNTIME_DIR when starting daemon on-demand Jim Porter
2021-10-30 19:37 ` Jim Porter
2021-10-30 22:33   ` Paul Eggert
2021-12-07 11:26     ` Stefan Kangas
2021-12-07 14:27       ` Eli Zaretskii
2021-12-07 14:58         ` Stefan Kangas
2021-12-07 19:03           ` Paul Eggert
2021-12-08  6:57             ` Jim Porter
2021-12-08 19:06               ` Paul Eggert
2021-12-08 19:16                 ` Eli Zaretskii
2021-12-08 20:23                   ` Stefan Kangas
2021-12-08 21:56                     ` Ulrich Mueller
2021-12-08 22:56                       ` Jim Porter
2021-12-08 23:44                       ` Paul Eggert [this message]
2021-12-09  0:19                         ` Ulrich Mueller
2021-12-09  7:32                       ` Eli Zaretskii
2021-12-09  7:44                         ` Ulrich Mueller
2021-12-09 17:12                           ` Paul Eggert
2021-12-09 18:34                             ` Eli Zaretskii
2021-12-09 19:45                               ` Jim Porter
2021-12-09 19:48                               ` Paul Eggert
2021-12-09 19:57                                 ` Eli Zaretskii
2021-12-09 20:04                                   ` Paul Eggert
2022-09-10  5:01                                     ` Lars Ingebrigtsen
2022-09-10  5:53                                       ` Paul Eggert via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-12-09  4:10             ` Richard Stallman
2021-11-05 10:38 ` bug#51327: 28.0.60; emacsclient warns about XDG_RUNTIME_DIR when starting daemon on demand Ulrich Mueller
2021-11-05 17:54   ` Jim Porter
2021-11-05 18:05     ` Ulrich Mueller
2021-11-05 18:38       ` Jim Porter
2021-11-05 19:02         ` Ulrich Mueller
2021-11-11 13:04           ` Ulrich Mueller
2021-11-11 17:06             ` Jim Porter
2021-11-12  2:21               ` Paul Eggert
2021-12-07 14:58   ` Stefan Kangas

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=21fa6f0f-bd1b-45da-c1d4-f5d44e3b2ffe@cs.ucla.edu \
    --to=eggert@cs.ucla.edu \
    --cc=51327@debbugs.gnu.org \
    --cc=jporterbugs@gmail.com \
    --cc=stefan@marxist.se \
    --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).