From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Jim Porter Newsgroups: gmane.emacs.bugs Subject: bug#51327: 28.0.60; emacsclient warns about XDG_RUNTIME_DIR when starting daemon on demand Date: Fri, 5 Nov 2021 10:54:29 -0700 Message-ID: <238ece9e-df13-a604-ba3a-36b346857423@gmail.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="29903"; mail-complaints-to="usenet@ciao.gmane.io" To: Ulrich Mueller , 51327@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Nov 05 18:55:14 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 1mj3Ql-0007PI-PQ for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 05 Nov 2021 18:55:11 +0100 Original-Received: from localhost ([::1]:33612 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mj3Qk-00014e-3r for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 05 Nov 2021 13:55:10 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:56344) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mj3Qc-00014T-LG for bug-gnu-emacs@gnu.org; Fri, 05 Nov 2021 13:55:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:35563) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mj3Qc-0001qj-9F for bug-gnu-emacs@gnu.org; Fri, 05 Nov 2021 13:55:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mj3Qb-00077s-V0 for bug-gnu-emacs@gnu.org; Fri, 05 Nov 2021 13:55:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Jim Porter Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 05 Nov 2021 17:55:01 +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.163613488027363 (code B ref 51327); Fri, 05 Nov 2021 17:55:01 +0000 Original-Received: (at 51327) by debbugs.gnu.org; 5 Nov 2021 17:54:40 +0000 Original-Received: from localhost ([127.0.0.1]:47109 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mj3QF-00077H-WF for submit@debbugs.gnu.org; Fri, 05 Nov 2021 13:54:40 -0400 Original-Received: from mail-pj1-f47.google.com ([209.85.216.47]:52868) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mj3QA-00076z-V1 for 51327@debbugs.gnu.org; Fri, 05 Nov 2021 13:54:38 -0400 Original-Received: by mail-pj1-f47.google.com with SMTP id h24so2496692pjq.2 for <51327@debbugs.gnu.org>; Fri, 05 Nov 2021 10:54:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=subject:to:references:from:message-id:date:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=qsjqsJuAG96HVuKLzky2sgHjBn6TzFCbNf8oEk+Exv0=; b=qX5EAf5MfMwkzKO56oCXJk8ZkHQj+L2q6xLPAsltnxN2MhKdFpXe2RvLDMrdrMgbOT oEHnVzzL1znzb0E1XETa9k60bT6kBSoAuE28YA/Un1ZVJA93KqwcUnDw1UvZvLeO8aLQ oel1oseLsar42py7StqDT8YomcKLgg6KaWW1t8nUDl2go5MPu1ev2yI0NMcw/4bXZQRI /EEnrwz7FjksgimCNDcDT0WSj/GR38UfKmS9bAVc1VvMuLMnScSfFTS/raqbbqzz56CL KhsBnnYBiphfgMjXWSgl5FejsKYfWb9f3+fSyDdFG/gXsvDqvpfCJGPaiYRSNg/RhXNf EKiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:to:references:from:message-id:date :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=qsjqsJuAG96HVuKLzky2sgHjBn6TzFCbNf8oEk+Exv0=; b=3U2JcCA+87Qv51rN56VXMuvUWbuAdQmfTQLzZ9gmIWtJHOsdxajRr1GN89uW5g0bVd NLUS7dHjQlJtZrQQ6xsCnKpfzOOp+hf27rmChE/i7Z420r4HfxGKCL68R5Zzc7C6xLv9 wQ9YCHPRu++eIii+aD2eT3925ARWIFOUqb1yaBXtbVnN6jcMDhQ32iu8MwS2IJWe/0Lh T8RDwQV+DgEBNV5WeiimZ7Dt6BbWGmkQVm8PSlH4ZgZVKCsNVN52ofXfzn7nTMPn1uJI sbwCRdW53C4a9bN2P/c/+It9GWL9oEjaGCWvcu2kYSfY+QOrMiZCYpsEY1CQ+3s+b/Ou 7I7g== X-Gm-Message-State: AOAM530s+oC9FzOQr8s155SYtD19oEj1F77Tc5tm2MTew8ChAtwbBtmB dMns+fS5PN02MpsT/5jS0NV5GeRaxbo= X-Google-Smtp-Source: ABdhPJz4EbC+qm9JtNL4qPckRdBYp/683PPIcIaVJ0GM6+r2lPuBtFktQuO09d2GwAfgnqNyd8CsyQ== X-Received: by 2002:a17:90a:8912:: with SMTP id u18mr31223649pjn.69.1636134869067; Fri, 05 Nov 2021 10:54:29 -0700 (PDT) Original-Received: from [192.168.1.2] (cpe-76-168-148-233.socal.res.rr.com. [76.168.148.233]) by smtp.googlemail.com with ESMTPSA id x193sm6526110pfd.160.2021.11.05.10.54.28 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 05 Nov 2021 10:54:28 -0700 (PDT) In-Reply-To: Content-Language: en-US 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:219015 Archived-At: On 11/5/2021 3:38 AM, Ulrich Mueller wrote: > 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? It's not just a spurious warning; the warning is telling the user about a real problem, though the wording is a bit confusing for this particular case. If a user calls `emacsclient --alternate-editor=""' with XDG_RUNTIME_DIR set and no Emacs server running, emacsclient will check in both XDG_RUNTIME_DIR and TMPDIR to find the server socket before giving up and starting the daemon. Since XDG_RUNTIME_DIR exists (at least in part) to prevent symlink attacks, Emacs should try to avoid checking TMPDIR in order to avoid this vulnerability. Emacs 27 is secure in this regard, since it *never* checks TMPDIR if XDG_RUNTIME_DIR is set. However, that behavior caused the problems described in bug#33847. The patch I posted is a compromise that restores the secure behavior for users who set the alternate editor and want to start the Emacs daemon on demand (it's not perfect though; see my reply in emacs-devel).