GNU bug report logs - #23463
safe local variable properties no longer effective

Previous Next

Package: emacs;

Reported by: Glenn Morris <rgm <at> gnu.org>

Date: Thu, 5 May 2016 22:01:02 UTC

Severity: normal

Merged with 23460

Found in version 25.1.50

Done: Alan Mackenzie <acm <at> muc.de>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 23463 in the body.
You can then email your comments to 23463 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to acm <at> muc.de, bug-gnu-emacs <at> gnu.org:
bug#23463; Package emacs. (Thu, 05 May 2016 22:01:02 GMT) Full text and rfc822 format available.

Message #3 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: submit <at> debbugs.gnu.org
Subject: safe local variable properties no longer effective
Date: Thu, 05 May 2016 17:59:55 -0400
Package: emacs
Version: 25.1.50

emacs -Q foo.py

where foo.py has contents:

# Local Variables:
# python-indent-offset: 2
# End:

Current emacs-25 branch: file opens fine with no prompting,
python-indent-offset is set to 2.
Current master: one is told that python-indent-offset is not safe

Same applies to any similar major-mode-specific local variable.

This is due to 25f455815bfaa868dc470d445413df9a7a546c46.




Added indication that bug 23463 blocks21966 Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Thu, 05 May 2016 22:03:01 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#23463; Package emacs. (Fri, 06 May 2016 09:15:01 GMT) Full text and rfc822 format available.

Message #8 received at 23463 <at> debbugs.gnu.org (full text, mbox):

From: Alan Mackenzie <acm <at> muc.de>
To: Glenn Morris <rgm <at> gnu.org>
Cc: 23463 <at> debbugs.gnu.org
Subject: Re: bug#23463: safe local variable properties no longer effective
Date: Fri, 6 May 2016 09:14:54 +0000
Hello, Glenn.

On Thu, May 05, 2016 at 05:59:55PM -0400, Glenn Morris wrote:
> Package: emacs
> Version: 25.1.50

> emacs -Q foo.py

> where foo.py has contents:

> # Local Variables:
> # python-indent-offset: 2
> # End:

> Current emacs-25 branch: file opens fine with no prompting,
> python-indent-offset is set to 2.
> Current master: one is told that python-indent-offset is not safe

Yes.  What is happening is that the call to `fundamental-mode' at the
beginning of `normal-mode' is itself calling `hack-local-variables' (via
`run-mode-hooks').  This is wrong.  At that stage, python-mode has not
yet been loaded, so `hack-local-variables' doesn't know that
`python-indent-offset' is "safe".

> Same applies to any similar major-mode-specific local variable.

> This is due to 25f455815bfaa868dc470d445413df9a7a546c46.

Please try out the following, and let me know how it works:



diff --git a/lisp/files.el b/lisp/files.el
index d89b2f5..21f7bdc 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -2316,7 +2316,10 @@ normal-mode
 or from Lisp without specifying the optional argument FIND-FILE;
 in that case, this function acts as if `enable-local-variables' were t."
   (interactive)
-  (fundamental-mode)
+  (kill-all-local-variables)
+  (unless delay-mode-hooks
+    (run-hooks 'change-major-mode-after-body-hook
+               'after-change-major-mode-hook))
   (let ((enable-local-variables (or (not find-file) enable-local-variables)))
     ;; FIXME this is less efficient than it could be, since both
     ;; s-a-m and h-l-v may parse the same regions, looking for "mode:".


-- 
Alan Mackenzie (Nuremberg, Germany).




Merged 23460 23463. Request was from Kaushal Modi <kaushal.modi <at> gmail.com> to control <at> debbugs.gnu.org. (Fri, 06 May 2016 14:35:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#23463; Package emacs. (Fri, 06 May 2016 15:56:02 GMT) Full text and rfc822 format available.

Message #13 received at 23463 <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: Alan Mackenzie <acm <at> muc.de>
Cc: 23463 <at> debbugs.gnu.org
Subject: Re: bug#23463: safe local variable properties no longer effective
Date: Fri, 06 May 2016 11:55:27 -0400
A test case was provided so you can test it yourself. :)
This is a change to very long-standing behaviour, and I would not be
surprised to see various subtle issues due to it. Eg calling any
major-mode function may now prompt the user and wait indefinitely for a
response.

I think it needs a NEWS entry, BTW.




Reply sent to Alan Mackenzie <acm <at> muc.de>:
You have taken responsibility. (Fri, 06 May 2016 19:25:02 GMT) Full text and rfc822 format available.

Notification sent to Glenn Morris <rgm <at> gnu.org>:
bug acknowledged by developer. (Fri, 06 May 2016 19:25:02 GMT) Full text and rfc822 format available.

Message #18 received at 23463-done <at> debbugs.gnu.org (full text, mbox):

From: Alan Mackenzie <acm <at> muc.de>
To: Glenn Morris <rgm <at> gnu.org>
Cc: 23463-done <at> debbugs.gnu.org
Subject: Re: bug#23463: safe local variable properties no longer effective
Date: Fri, 6 May 2016 19:24:14 +0000
Bug fixed in master branch.

-- 
Alan Mackenzie (Nuremberg, Germany).




Reply sent to Alan Mackenzie <acm <at> muc.de>:
You have taken responsibility. (Fri, 06 May 2016 19:25:02 GMT) Full text and rfc822 format available.

Notification sent to Kaushal Modi <kaushal.modi <at> gmail.com>:
bug acknowledged by developer. (Fri, 06 May 2016 19:25:03 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#23463; Package emacs. (Fri, 06 May 2016 19:35:02 GMT) Full text and rfc822 format available.

Message #26 received at 23463 <at> debbugs.gnu.org (full text, mbox):

From: Alan Mackenzie <acm <at> muc.de>
To: Glenn Morris <rgm <at> gnu.org>
Cc: 23463 <at> debbugs.gnu.org
Subject: Re: bug#23463: safe local variable properties no longer effective
Date: Fri, 6 May 2016 19:34:51 +0000
Hello, Glenn.

On Fri, May 06, 2016 at 11:55:27AM -0400, Glenn Morris wrote:

> A test case was provided so you can test it yourself. :)

I have done so.  But sometimes, admittedly not very often, a fix works
in the test case, but not in the real code the error was observed in.

Anyhow, I've committed the fix.

> This is a change to very long-standing behaviour, and I would not be
> surprised to see various subtle issues due to it. Eg calling any
> major-mode function may now prompt the user and wait indefinitely for a
> response.

This could happen, but only on a file the user has already
accepted/rejected the local variables for.

> I think it needs a NEWS entry, BTW.

Done.

-- 
Alan Mackenzie (Nuremberg, Germany).




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sat, 04 Jun 2016 11:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 9 years and 76 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.