unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Tassilo Horn <tsdh@gnu.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: "João Távora" <joaotavora@gmail.com>,
	emacs-devel@gnu.org, "Sam Steingold" <sds@gnu.org>
Subject: Re: Unsafe local variable in eglot.el
Date: Thu, 09 Mar 2023 13:10:15 +0100	[thread overview]
Message-ID: <877cvqyupi.fsf@gnu.org> (raw)
In-Reply-To: <831qly2l5k.fsf@gnu.org>

Eli Zaretskii <eliz@gnu.org> writes:

Hi Eli, João & Sam,

Sam, for the context: when you find eglot.el in the current emacs
master, it'll trigger a query because of the eglot.el local variable
setting

--8<---------------cut here---------------start------------->8---
;; Local Variables:
;; bug-reference-bug-regexp: "\\(\\(github\\|bug\\)#\\([0-9]+\\)\\)"
;; bug-reference-url-format: eglot--debbugs-or-github-bug-uri
;; checkdoc-force-docstrings-flag: nil
;; End:
--8<---------------cut here---------------end--------------->8---

(Now probably this mail will do the same. :-))

>> I've reproduced it with
>> 
>>   cd path/to/Emacs
>>   src/emacs -Q lisp/progmodes/eglot.el
>> 
>> But curiously, this doesn't reproduce it
>> 
>>   src/emacs -Q
>>   C-h f eglot RET
>>   C-x o TAB RET  ;; to visit the "eglot.el" link
>> 
>> Why is that?

I can reproduce it, too.

> I don't know.  Maybe the latter already has bug-reference.el loaded?

I think the reason is that bug-reference-url-format is a safe local
variable if it is

  (a) a string, or
  (b) a symbol which itself has the bug-reference-url-format property
      set to a non-nil value

When you find eglot.el the function eglot--debbugs-or-github-bug-uri
defined in eglot.el doesn't have the property because eglot.el itself is
not loaded yet.

When you visit eglot.el following a help link, it seems eglot gets
loaded, and therefore the bug-reference-url-format function
eglot--debbugs-or-github-bug-uri is defined and has the right property.

Not sure what to do here.  Maybe adding an autoload-cookie to
eglot--debbugs-or-github-bug-uri does the trick?  Of course, then you
cannot find eglot.el without loading it at the same time...

I've added Sam to the Cc because he added the (b) clause.  Before the
bug url format has been considered safe if it was string or function but
I think even that would trigger the issue.

Bye,
Tassilo



  reply	other threads:[~2023-03-09 12:10 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-09  8:00 Unsafe local variable in eglot.el Eli Zaretskii
2023-03-09  9:31 ` João Távora
2023-03-09 11:24   ` João Távora
2023-03-09 12:19     ` Eli Zaretskii
2023-03-09 13:07       ` João Távora
2023-03-09 15:54         ` Eli Zaretskii
2023-03-09 11:56   ` Eli Zaretskii
2023-03-09 12:10     ` Tassilo Horn [this message]
2023-03-09 13:12       ` João Távora
2023-03-10  7:44         ` Tassilo Horn
2023-03-09 12:19     ` João Távora

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=877cvqyupi.fsf@gnu.org \
    --to=tsdh@gnu.org \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=joaotavora@gmail.com \
    --cc=sds@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).