GNU bug report logs -
#74627
.dir-locals.el warning messages are confusing
Previous Next
Full log
Message #17 received at 74627 <at> debbugs.gnu.org (full text, mbox):
> From: Björn Lindqvist <bjourne <at> gmail.com>
> Date: Wed, 11 Dec 2024 09:18:33 +0100
> Cc: Stefan Monnier <monnier <at> iro.umontreal.ca>, 74627 <at> debbugs.gnu.org
>
> Den tors 5 dec. 2024 kl 10:38 skrev Eli Zaretskii <eliz <at> gnu.org>:
>
> > > 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?
Yes, that's my reading of the code.
> 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).
Well, we consider variables in .dir-locals.el as belonging to the
directory in which it lives.
> > > 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.
I can only guess: showing all of them lets you see the problematic one
in context.
This bug report was last modified 167 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.