Subject: Re: bug#74627: .dir-locals.el warning messages are confusing

From: Björn Lindqvist <[email-masked]>
Date: Wed, 11 Dec 2024 09:18:33 +0100

Hello Eli,

Den tors 5 dec. 2024 kl 10:38 skrev Eli Zaretskii <[email-masked]>:

> > Warnings about potential security issues should be easy to understand,
> > but the warnings produced by .dir-locals.el are not. When I open a
> > file in the Emacs source code it shows:
> >
> >     The local variables list in /home/bjourne/p/emacs/
> >     or .dir-locals.el contains values that may not be safe (*).
> >
> > Why does it say "or"?
>
> Because that function is called with a single flag argument which
> could be set non-nil either due to unsafe file-local variables or due
> to .dir-locals.el.

So there are multiple sources of unsafe variables, but the function
responsible for formulating the error message doesn't know what the
source is? Regardless of whether my guess is correct, the text should
not refer to the local variables in "/home/bjourne/p/emacs/" because
there can be no unsafe variables in directories (only files).

> > What does the asterisk (*) mean?
>
> It means the variables marked with the asterisk in the list of
> below this text could be unsafe.

Aha. Emacs lists both safe and unsafe variables. Why does it list the
safe ones? The warning would be much clearer if the safe variables
were omitted since they don't matter. That would make it clear what
variables "!" and "i" choices apply or mark as safe/ignored.

--
mvh/best regards Björn Lindqvist