From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Ulrich Mueller Newsgroups: gmane.emacs.bugs Subject: bug#33847: 27.0.50; emacsclient does not find server socket Date: Wed, 26 Dec 2018 16:14:14 +0100 Message-ID: References: <8a6fc59c-08b3-e274-4fb1-74674c79540a@cs.ucla.edu> <9ebcad22-2cdb-46fb-4be9-efc4ad234b6d@cs.ucla.edu> <476852d0-9cd6-a6ae-a11d-bb4d761323da@cs.ucla.edu> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1545837195 16742 195.159.176.226 (26 Dec 2018 15:13:15 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 26 Dec 2018 15:13:15 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) Cc: 33847@debbugs.gnu.org To: Paul Eggert Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Dec 26 16:13:11 2018 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gcAru-0004DO-AH for geb-bug-gnu-emacs@m.gmane.org; Wed, 26 Dec 2018 16:13:10 +0100 Original-Received: from localhost ([127.0.0.1]:46756 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gcAu0-00017o-OC for geb-bug-gnu-emacs@m.gmane.org; Wed, 26 Dec 2018 10:15:20 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:50676) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gcAtn-00017e-31 for bug-gnu-emacs@gnu.org; Wed, 26 Dec 2018 10:15:07 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gcAti-00082G-5r for bug-gnu-emacs@gnu.org; Wed, 26 Dec 2018 10:15:07 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:36631) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gcAti-00081y-2U for bug-gnu-emacs@gnu.org; Wed, 26 Dec 2018 10:15:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1gcAth-0008D8-QW for bug-gnu-emacs@gnu.org; Wed, 26 Dec 2018 10:15:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Ulrich Mueller Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 26 Dec 2018 15:15:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 33847 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 33847-submit@debbugs.gnu.org id=B33847.154583726631504 (code B ref 33847); Wed, 26 Dec 2018 15:15:01 +0000 Original-Received: (at 33847) by debbugs.gnu.org; 26 Dec 2018 15:14:26 +0000 Original-Received: from localhost ([127.0.0.1]:37865 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gcAt8-0008C4-IX for submit@debbugs.gnu.org; Wed, 26 Dec 2018 10:14:26 -0500 Original-Received: from smtp.gentoo.org ([140.211.166.183]:55390) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gcAt7-0008Bq-2G for 33847@debbugs.gnu.org; Wed, 26 Dec 2018 10:14:25 -0500 Original-Received: from a1i15 (host2092.kph.uni-mainz.de [134.93.134.92]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: ulm) by smtp.gentoo.org (Postfix) with ESMTPSA id 0E704335C30; Wed, 26 Dec 2018 15:14:17 +0000 (UTC) In-Reply-To: <476852d0-9cd6-a6ae-a11d-bb4d761323da@cs.ucla.edu> (Paul Eggert's message of "Tue, 25 Dec 2018 22:59:08 -0800") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 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.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:153867 Archived-At: >>>>> On Wed, 26 Dec 2018, Paul Eggert wrote: > Ulrich Mueller wrote: >> XDG_RUNTIME_DIR is simply not suitable for the purpose, because (by its >> specification) it will disappear when the login session ends, > I think the idea is that XDG_RUNTIME_DIR disappears when all login > sessions end, so it might survive the current session. I still don't see why XDG_RUNTIME_DIR would be more secure than using a directory in TMPDIR. server.el seems to take all necessary precautions to ensure that the directory is safe: server-ensure-safe-dir is a compiled Lisp function in =E2=80=98server.el= =E2=80=99. (server-ensure-safe-dir DIR) Make sure DIR is a directory with no race-condition issues. Creates the directory if necessary and makes sure: - there=E2=80=99s no symlink involved - it=E2=80=99s owned by us - it=E2=80=99s not readable/writable by anybody else. In addition, emacsclient checks for the ownership of the socket before connecting to it. >> No need for Emacs itself to be setgid, because the directory could >> be created by calling an auxiliary setgid program (similar to >> update-game-score). > That might work, as a solution for people who want Emacs to keep > running even when they entirely log out. It would also be rather complicated, and require creation of an emacs group. Using a directory where the user has write access is easier. AFAICS, the three candidates for that are TMPDIR, HOME, and XDG_RUNTIME_DIR. Emacs 26 uses ${TMPDIR}/emacs${UID}/ or ${HOME}/.emacs.d/server/ depending on the server-use-tcp flag. Emacs 27 will use one of these two or ${XDG_RUNTIME_DIR} as a default (depending on the environment). IMHO this is approaching the point where things become unpredictable and hard to understand for the user. (And making it more customizable won't make it simpler, I fear.) If TMPDIR really is insecure (see above), can't the socket be placed in ${HOME}/.emacs.d/ which is already used in the TCP case? The socket could be named server-, in order to avoid issues with NFS mounted directories.