summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGlenn Morris <rgm@gnu.org>2012-08-07 14:41:39 -0400
committerGlenn Morris <rgm@gnu.org>2012-08-07 14:41:39 -0400
commitf40b9f106b43a3602ae10db0261de924dc5c5b59 (patch)
tree3384b3c4281312da656634cb46cccc937c68819e
parentdb74a5fcb7ebed92c0a944c38b61de1c7ebb87d0 (diff)
downloademacs-f40b9f106b43a3602ae10db0261de924dc5c5b59.tar.gz
hack-local-variables-filter fix for bug#12155
* lisp/files.el (hack-local-variables-filter): If an eval: form is not known to be safe, and enable-local-variables is :safe, then ignore the form totally, as is done for non-eval forms.
-rw-r--r--lisp/ChangeLog6
-rw-r--r--lisp/files.el15
2 files changed, 16 insertions, 5 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index d8bf55e0066..7d61d9d69b8 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,9 @@
+2012-08-07 Glenn Morris <rgm@gnu.org>
+
+ * files.el (hack-local-variables-filter): If an eval: form is not
+ known to be safe, and enable-local-variables is :safe, then ignore
+ the form totally, as is done for non-eval forms. (Bug#12155)
+
2012-08-07 Chong Yidong <cyd@gnu.org>
* mouse.el (mouse-drag-track): Deactivate the mark before popping.
diff --git a/lisp/files.el b/lisp/files.el
index cf9521731e2..02c9e04311e 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -3107,11 +3107,16 @@ DIR-NAME is the name of the associated directory. Otherwise it is nil."
;; Obey `enable-local-eval'.
((eq var 'eval)
(when enable-local-eval
- (push elt all-vars)
- (or (eq enable-local-eval t)
- (hack-one-local-variable-eval-safep (eval (quote val)))
- (safe-local-variable-p var val)
- (push elt unsafe-vars))))
+ (let ((safe (or (hack-one-local-variable-eval-safep
+ (eval (quote val)))
+ ;; In case previously marked safe (bug#5636).
+ (safe-local-variable-p var val))))
+ ;; If not safe and e-l-v = :safe, ignore totally.
+ (when (or safe (not (eq enable-local-variables :safe)))
+ (push elt all-vars)
+ (or (eq enable-local-eval t)
+ safe
+ (push elt unsafe-vars))))))
;; Ignore duplicates (except `mode') in the present list.
((and (assq var all-vars) (not (eq var 'mode))) nil)
;; Accept known-safe variables.