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.devel Subject: Re: emacsclient startup messages Date: Sat, 30 Oct 2021 12:16:55 -0700 Message-ID: References: <89dc096b-6c33-db5a-d2d2-b43fb92e4900@gmail.com> 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="1173"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Pedro Andres Aranda Gutierrez , emacs-devel To: Ulrich Mueller Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Oct 30 21:18:25 2021 Return-path: Envelope-to: ged-emacs-devel@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 1mgts0-000064-Lr for ged-emacs-devel@m.gmane-mx.org; Sat, 30 Oct 2021 21:18:24 +0200 Original-Received: from localhost ([::1]:45598 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mgtry-0000qI-ML for ged-emacs-devel@m.gmane-mx.org; Sat, 30 Oct 2021 15:18:22 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:50146) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mgtqe-0007rg-H6 for emacs-devel@gnu.org; Sat, 30 Oct 2021 15:17:00 -0400 Original-Received: from mail-pf1-x429.google.com ([2607:f8b0:4864:20::429]:37676) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mgtqc-0004bR-CR for emacs-devel@gnu.org; Sat, 30 Oct 2021 15:17:00 -0400 Original-Received: by mail-pf1-x429.google.com with SMTP id y20so1733199pfi.4 for ; Sat, 30 Oct 2021 12:16:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=subject:to:cc:references:from:message-id:date:mime-version :in-reply-to:content-language:content-transfer-encoding; bh=eWzyLOjFoPuUOKVukTs751aDvbX6HL/3WDb6KcEFeX0=; b=lhlKm0ojriOwjCYhTliEsFQrbsYxEQoKJUiR23ELsSs3MRV9MXp7mrBJGbZTd8GDTE WAbDMPxLAQp+kWioyel41nirZc7m7wNcitn7stagewhCxkJTw+zPt9372JpcDFhpkIEx WdRawv022S+NVogAQ9T7TX+raPROCr4A1K35KxUU8SihqrOyH1Mz6ehAWLMk3H0bwx1u sFxzTK9NpUAYbWhGDq013VxJLT4cKEC1N29xidwjp29MiY0MYfXe8DEw2io0XGovUYac pk/yixnRWCHbvcQdYRqhuzI+VbiPjrX39p63jlMKD6PQpqyAFpWxdJtVtq7dOo1kALhi 9Jow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=eWzyLOjFoPuUOKVukTs751aDvbX6HL/3WDb6KcEFeX0=; b=Nc1AXAaibwEg55DQNmsgk5QDkphSxUf5QlKs672ksvwuPbYRIvB9KBDrYSpLb0ChIB vEj7PCXGX0U0lLkdCgoq7wf8l8oE/gmZhhVNmBofUx92UoAsElToycJBB8gcW5/H4qUc X0XITlKr6VfBrlT1XQSvsQ9iUqJPnG+8Lae0vRiXQVG+wc6D+cwfKfwGEDgeelA+zZlc gekGAf3G/MggRCYbEn7G9MBjqWEiANkFQfkkiKhoRyvmdwuv+T+OQ4n6apEBSumIcv8C HLnQvboPNpH03R8ZtX2I10RGq6Gs9x5rzb+LnLoda52+W1rDdKMP2eCcqt7sA9QmegPL 9jow== X-Gm-Message-State: AOAM533wd6teO6ge6eJa8Ns/InaB45+UDC46Fwk8AE4v+m/Kj+Otr055 RHhgepiSB2hYC4JJtHpQgVvKWvdoKvo= X-Google-Smtp-Source: ABdhPJwFZzFIOfOlXdX5LuL4lwadZj8Ge9p+E5/bOpzgDPE9thWkKUYtJbz0cUVFvx0PazeamZ/J4w== X-Received: by 2002:a63:f62:: with SMTP id 34mr13691875pgp.159.1635621416346; Sat, 30 Oct 2021 12:16:56 -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 c3sm13863649pji.0.2021.10.30.12.16.55 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 30 Oct 2021 12:16:56 -0700 (PDT) In-Reply-To: Content-Language: en-US Received-SPF: pass client-ip=2607:f8b0:4864:20::429; envelope-from=jporterbugs@gmail.com; helo=mail-pf1-x429.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:278289 Archived-At: 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