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.bugs Subject: bug#51327: 28.0.60; emacsclient warns about XDG_RUNTIME_DIR when starting daemon on demand Date: Fri, 05 Nov 2021 11:38:40 +0100 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="27425"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) To: 51327@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Nov 05 11:39:11 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1miwcp-0006zq-IF for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 05 Nov 2021 11:39:11 +0100 Original-Received: from localhost ([::1]:49598 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1miwcn-00060i-Jv for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 05 Nov 2021 06:39:09 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:57794) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1miwcg-000605-LU for bug-gnu-emacs@gnu.org; Fri, 05 Nov 2021 06:39:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:33403) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1miwcg-0007gk-DK for bug-gnu-emacs@gnu.org; Fri, 05 Nov 2021 06:39:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1miwcg-00084O-3G for bug-gnu-emacs@gnu.org; Fri, 05 Nov 2021 06:39:02 -0400 X-Loop: help-debbugs@gnu.org In-Reply-To: Resent-From: Ulrich Mueller Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 05 Nov 2021 10:39:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 51327 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: security Original-Received: via spool by 51327-submit@debbugs.gnu.org id=B51327.163610873431004 (code B ref 51327); Fri, 05 Nov 2021 10:39:02 +0000 Original-Received: (at 51327) by debbugs.gnu.org; 5 Nov 2021 10:38:54 +0000 Original-Received: from localhost ([127.0.0.1]:44947 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1miwcY-000840-1K for submit@debbugs.gnu.org; Fri, 05 Nov 2021 06:38:54 -0400 Original-Received: from woodpecker.gentoo.org ([140.211.166.183]:37806 helo=smtp.gentoo.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1miwcV-00083i-Kb for 51327@debbugs.gnu.org; Fri, 05 Nov 2021 06:38:52 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:218988 Archived-At: --=-=-= Content-Type: text/plain If I understand this report correctly, the problem is just the spurious warning about XDG_RUNTIME_DIR? Instead of changing the functionality (which breaks other use cases, see my message to emacs-devel), wouldn't it make more sense to just suppress the warning if the variable is set? As in attached patch? --=-=-= Content-Type: text/plain Content-Disposition: attachment; filename=0001-Suppress-a-spurious-warning-in-emacsclient.patch >From 8b13b4ce6b5c5998ea8dc6db0c1021f2beba41aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ulrich=20M=C3=BCller?= Date: Fri, 5 Nov 2021 11:30:28 +0100 Subject: [PATCH] Suppress a spurious warning in emacsclient * lib-src/emacsclient.c (set_local_socket): Suppress warning about unset XDG_RUNTIME_DIR if the variable is actually set. (Bug#51327) --- lib-src/emacsclient.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c index 0e800dd7e8..d812ae6bc8 100644 --- a/lib-src/emacsclient.c +++ b/lib-src/emacsclient.c @@ -1447,6 +1447,7 @@ set_local_socket (char const *server_name) int tmpdirlen = -1; int socknamelen = -1; uid_t uid = geteuid (); + char const *xdg_runtime_dir = NULL; bool tmpdir_used = false; int s = cloexec_socket (AF_UNIX, SOCK_STREAM, 0); if (s < 0) @@ -1468,7 +1469,7 @@ set_local_socket (char const *server_name) { /* socket_name is a file name component. */ sock_status = ENOENT; - char const *xdg_runtime_dir = egetenv ("XDG_RUNTIME_DIR"); + xdg_runtime_dir = egetenv ("XDG_RUNTIME_DIR"); if (xdg_runtime_dir) { socknamelen = snprintf (sockname, socknamesize, "%s/emacs/%s", @@ -1559,7 +1560,8 @@ set_local_socket (char const *server_name) int sockdirnamelen = snprintf (sockdirname, sizeof sockdirname, "/run/user/%"PRIuMAX, id); if (0 <= sockdirnamelen && sockdirnamelen < sizeof sockdirname - && faccessat (AT_FDCWD, sockdirname, X_OK, AT_EACCESS) == 0) + && faccessat (AT_FDCWD, sockdirname, X_OK, AT_EACCESS) == 0 + && !xdg_runtime_dir) message (true, ("%s: Should XDG_RUNTIME_DIR='%s' be in the environment?\n" -- 2.33.1 --=-=-=--