From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= Newsgroups: gmane.emacs.bugs Subject: bug#48452: 28.0.50; flymake for elisp does not respect `load-path` Date: Mon, 18 Jul 2022 20:17:26 +0100 Message-ID: <87sfmy1b95.fsf@gmail.com> References: <8735unafob.fsf@gmail.com> <877d4hs084.fsf@gnus.org> <87v8s1untg.fsf@gmail.com> <874jzlp12v.fsf@gnus.org> <87wnchc75r.fsf@gmail.com> <87ilnzaa49.fsf@gnus.org> <87cze7780j.fsf@gmail.com> <87r12mogh9.fsf@gnus.org> <87fsj1tlgn.fsf@gnus.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="18888"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) Cc: Max Brieiev , 48452@debbugs.gnu.org To: Lars Ingebrigtsen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Jul 18 21:48:24 2022 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 1oDWj9-0004YJ-PA for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 18 Jul 2022 21:48:23 +0200 Original-Received: from localhost ([::1]:43134 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oDWj8-0006gP-MC for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 18 Jul 2022 15:48:22 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:40918) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oDWEp-0005IO-17 for bug-gnu-emacs@gnu.org; Mon, 18 Jul 2022 15:17:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:54369) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oDWEo-0003mp-Nz for bug-gnu-emacs@gnu.org; Mon, 18 Jul 2022 15:17:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oDWEo-0002K3-9I for bug-gnu-emacs@gnu.org; Mon, 18 Jul 2022 15:17:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 18 Jul 2022 19:17:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 48452 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: moreinfo Original-Received: via spool by 48452-submit@debbugs.gnu.org id=B48452.16581717798858 (code B ref 48452); Mon, 18 Jul 2022 19:17:02 +0000 Original-Received: (at 48452) by debbugs.gnu.org; 18 Jul 2022 19:16:19 +0000 Original-Received: from localhost ([127.0.0.1]:52128 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oDWE7-0002Io-1S for submit@debbugs.gnu.org; Mon, 18 Jul 2022 15:16:19 -0400 Original-Received: from mail-wr1-f47.google.com ([209.85.221.47]:41585) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oDWE5-0002Ic-7m for 48452@debbugs.gnu.org; Mon, 18 Jul 2022 15:16:18 -0400 Original-Received: by mail-wr1-f47.google.com with SMTP id n12so5618616wrc.8 for <48452@debbugs.gnu.org>; Mon, 18 Jul 2022 12:16:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:in-reply-to:references:date:message-id :user-agent:mime-version:content-transfer-encoding; bh=sldqT+kBnqs1caoPcOWkjG/x6yvX1tOrFNrW5fg5sDs=; b=P+lN9zg/Xb+3fONzIFnrXoL3LEBTnkQC+LYa2HQLyBYez1BiBhGLvT7YnLEaNVgPSj uZ7vZ808r6lPQu2/rFUPH9zGvwQoXwYeJjpAY62ysVhW+sZOBkZ9vCO1o73xyKHKiMqe v+yet5FK3c2FZMtYqgjInCUr11VcSLuEVyOyLjSwKCm3sCYvkqSPx/cuh+izoHd73IYs TpxOcMR9pUpWkqvGmHCVgWnAuvihLY8cwYl0f9sef/JspDCH3sIfzL8DDg7ZYebqkgpM dL8limMBaimdWO1agWo9WLcpE3yBhqFamwW9MfwgC/5wMiMdsS1fW6mECTuDyH9qfzUo ERlQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references:date :message-id:user-agent:mime-version:content-transfer-encoding; bh=sldqT+kBnqs1caoPcOWkjG/x6yvX1tOrFNrW5fg5sDs=; b=HdbXN/XCqmL0RLkxnHg6zCVQYjn12cDF5pkuqwfOm83n1fwwD9H9jwF9vudc2LIvXv 3Zr0S2JfpdyOEYCEkg9EzMwAsRwk9Y4USen21ewYnjl3XvaBkDbaRkzbXtnxDFArI+sl Dj3e/vMU/x/kmKDgyYCpe/ZUE/m+hZLUllxAIQgbQBpgNZYjVkHDPh0B1FiQtrRP04Ob AOriA+bEVqaKZ2JzZaZZWu/IJIa9HvG9WXj0LT5ublmRGKWPWBVyeg43jdFAPv+F/V0E yywXfIGSSXs4iBKH0LXDjRJwBrEOXRyNGzrnk3anWxhb8YiMvBbqdHlfbZkIc/ci9sK7 yOvg== X-Gm-Message-State: AJIora90QB3cDLsG6SSGT9HqJYUHAAlNjKGV4oovImdtD0FhLNe0dhul xDZnZ2ygVx8x1KNR/O9NxbC51RzG5sg= X-Google-Smtp-Source: AGRyM1vrSDTMLBi+cM0Vdx9D+ipKBkAQfwxqx3dDz39/PChBzmHZLST/qMaE16IFwCdoSJiJFPlfzg== X-Received: by 2002:adf:fbcc:0:b0:21e:117d:f56f with SMTP id d12-20020adffbcc000000b0021e117df56fmr6345089wrs.658.1658171771004; Mon, 18 Jul 2022 12:16:11 -0700 (PDT) Original-Received: from krug ([87.196.73.69]) by smtp.gmail.com with ESMTPSA id bp7-20020a5d5a87000000b0021d80f53324sm11732285wrb.7.2022.07.18.12.16.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Jul 2022 12:16:10 -0700 (PDT) In-Reply-To: <87fsj1tlgn.fsf@gnus.org> (Lars Ingebrigtsen's message of "Sat, 16 Jul 2022 12:12:40 +0200") 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:237383 Archived-At: Lars Ingebrigtsen writes: > Jo=C3=A3o T=C3=A1vora writes: > Speaking of which, I was surprised that flymake adds "./" to the load > path -- we never use that in real Emacsen exactly because of security > considerations (we don't want to pick up stray files when working under > /tmp/, for instance). Right. Adding anything to the load path is "dangerous". The default "./" is a good compromise, as it enables developing packages with multiple .el files that require each other in the same dir, which is a very common thing IME. >> Anyway, because the directories under ~/.emacs.d/elpa are somewhat speci= al >> and/or security-vetted it _could_ make sense to add them to the default >> value of the variable. This would amount to more or less the same as=20 >> calling the underlying process with `-f package-initialize` I think. >> >> But I'm still not sure this should be the default, or merely an option t= o=20 >> the flymake-elisp-byte-compile backend. I think the second is safer. > > An option here would be nice, yes. Here's a very minimally tested patch: diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el index 0c4a9bfdbe..7e1141acf1 100644 --- a/lisp/progmodes/elisp-mode.el +++ b/lisp/progmodes/elisp-mode.el @@ -2119,6 +2119,11 @@ elisp-flymake-byte-compile-load-path (dolist (path x t) (unless (stringp path) (throw 'tag nil))))= ))) =20 +(defcustom elisp-flymake-byte-compile-use-elpa-dirs nil + "If non-nil, add ELPA package dirs to elisp Flymake load path." + :type 'boolean + :group 'lisp) + ;;;###autoload (defun elisp-flymake-byte-compile (report-fn &rest _args) "A Flymake backend for elisp byte compilation. @@ -2146,6 +2151,8 @@ elisp-flymake-byte-compile ;; "--eval" "(setq load-prefer-newer t)" ; for testing ,@(mapcan (lambda (path) (list "-L" path)) elisp-flymake-byte-compile-load-path) + ,@(when elisp-flymake-byte-compile-use-elpa-dirs + `("-f" "package-initialize")) "-f" "elisp-flymake--batch-compile-for-flymake" ,temp-file) :connection-type 'pipe