summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--admin/ChangeLog4
-rw-r--r--admin/bzrmerge.el3
-rw-r--r--lisp/ChangeLog15
-rw-r--r--lisp/emacs-lisp/autoload.el6
-rw-r--r--lisp/emacs-lisp/copyright.el9
-rw-r--r--lisp/files.el15
-rw-r--r--lisp/tutorial.el6
-rw-r--r--src/ChangeLog11
-rw-r--r--src/unexmacosx.c41
-rw-r--r--test/ChangeLog12
-rw-r--r--test/automated/Makefile.in2
-rw-r--r--test/automated/files.el52
12 files changed, 158 insertions, 18 deletions
diff --git a/admin/ChangeLog b/admin/ChangeLog
index 79a55707dd4..f9986951388 100644
--- a/admin/ChangeLog
+++ b/admin/ChangeLog
@@ -1,3 +1,7 @@
+2012-08-10 Glenn Morris <rgm@gnu.org>
+
+ * bzrmerge.el (bzrmerge-resolve): Disable local eval:.
+
2012-08-07 Dmitry Antipov <dmantipov@yandex.ru>
* coccinelle/overlay.cocci, coccinelle/symbol.cocci: Remove.
diff --git a/admin/bzrmerge.el b/admin/bzrmerge.el
index 977e95860e2..e174312143d 100644
--- a/admin/bzrmerge.el
+++ b/admin/bzrmerge.el
@@ -160,7 +160,8 @@ Type `y' to skip this revision,
(unless (file-exists-p file) (error "Bzrmerge-resolve: Can't find %s" file))
(with-demoted-errors
(let ((exists (find-buffer-visiting file)))
- (with-current-buffer (let ((enable-local-variables :safe))
+ (with-current-buffer (let ((enable-local-variables :safe)
+ (enable-local-eval nil))
(find-file-noselect file))
(if (buffer-modified-p)
(error "Unsaved changes in %s" (current-buffer)))
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index c2e45204026..dc921213b42 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,18 @@
+2012-08-10 Glenn Morris <rgm@gnu.org>
+
+ * emacs-lisp/copyright.el (copyright-update-directory): Logic fix.
+
+ * tutorial.el (help-with-tutorial):
+ * emacs-lisp/copyright.el (copyright-update-directory):
+ * emacs-lisp/autoload.el (autoload-find-generated-file)
+ (autoload-find-file): Disable local eval: (for insurance).
+
+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-10 Stefan Monnier <monnier@iro.umontreal.ca>
* emacs-lisp/rx.el (rx-constituents): Don't define as constant.
diff --git a/lisp/emacs-lisp/autoload.el b/lisp/emacs-lisp/autoload.el
index 3fc185dda25..e6e2d1e60e0 100644
--- a/lisp/emacs-lisp/autoload.el
+++ b/lisp/emacs-lisp/autoload.el
@@ -228,7 +228,8 @@ expression, in which case we want to handle forms differently."
(defun autoload-find-generated-file ()
"Visit the autoload file for the current buffer, and return its buffer.
If a buffer is visiting the desired autoload file, return it."
- (let ((enable-local-variables :safe))
+ (let ((enable-local-variables :safe)
+ (enable-local-eval nil))
;; We used to use `raw-text' to read this file, but this causes
;; problems when the file contains non-ASCII characters.
(find-file-noselect
@@ -382,7 +383,8 @@ which lists the file name and which functions are in it, etc."
(emacs-lisp-mode)
(setq default-directory (file-name-directory file))
(insert-file-contents file nil)
- (let ((enable-local-variables :safe))
+ (let ((enable-local-variables :safe)
+ (enable-local-eval nil))
(hack-local-variables))
(current-buffer)))
diff --git a/lisp/emacs-lisp/copyright.el b/lisp/emacs-lisp/copyright.el
index 8e96d95c5dd..c3616c6e490 100644
--- a/lisp/emacs-lisp/copyright.el
+++ b/lisp/emacs-lisp/copyright.el
@@ -362,10 +362,11 @@ If FIX is non-nil, run `copyright-fix-years' instead."
(dolist (file (directory-files directory t match nil))
(unless (file-directory-p file)
(message "Updating file `%s'" file)
- (find-file file)
- (let ((inhibit-read-only t)
- (enable-local-variables :safe)
- copyright-query)
+ ;; FIXME we should not use find-file+save+kill.
+ (let ((enable-local-variables :safe)
+ (enable-local-eval nil))
+ (find-file file))
+ (let ((inhibit-read-only t))
(if fix
(copyright-fix-years)
(copyright-update)))
diff --git a/lisp/files.el b/lisp/files.el
index c5651135dc1..a7c9a7f7db4 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -3102,11 +3102,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.
diff --git a/lisp/tutorial.el b/lisp/tutorial.el
index e0e2a82fab9..64879e5cfd5 100644
--- a/lisp/tutorial.el
+++ b/lisp/tutorial.el
@@ -829,7 +829,8 @@ Run the Viper tutorial? "))
(if old-tut-file
(progn
(insert-file-contents (tutorial--saved-file))
- (let ((enable-local-variables :safe))
+ (let ((enable-local-variables :safe)
+ (enable-local-eval nil))
(hack-local-variables))
;; FIXME? What we actually want is to ignore dir-locals (?).
(setq buffer-read-only nil) ; bug#11118
@@ -848,7 +849,8 @@ Run the Viper tutorial? "))
(goto-char tutorial--point-before-chkeys)
(setq tutorial--point-before-chkeys (point-marker)))
(insert-file-contents (expand-file-name filename tutorial-directory))
- (let ((enable-local-variables :safe))
+ (let ((enable-local-variables :safe)
+ (enable-local-eval nil))
(hack-local-variables))
;; FIXME? What we actually want is to ignore dir-locals (?).
(setq buffer-read-only nil) ; bug#11118
diff --git a/src/ChangeLog b/src/ChangeLog
index 3b88f5c94e9..2bdf4bce0fb 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,14 @@
+2012-08-08 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
+
+ * unexmacosx.c (copy_data_segment): Copy initialized data in
+ statically linked libraries from input file rather than memory.
+
+2012-08-07 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
+
+ * unexmacosx.c (print_load_command_name): Add cases LC_MAIN,
+ LC_SOURCE_VERSION, and LC_DYLIB_CODE_SIGN_DRS.
+ (dump_it) [LC_DYLIB_CODE_SIGN_DRS]: Call copy_linkedit_data.
+
2012-08-10 Glenn Morris <rgm@gnu.org>
* conf_post.h (IF_LINT, lint_assume): Move here from lisp.h.
diff --git a/src/unexmacosx.c b/src/unexmacosx.c
index 0f5ad5498b0..05a16466dfb 100644
--- a/src/unexmacosx.c
+++ b/src/unexmacosx.c
@@ -607,6 +607,21 @@ print_load_command_name (int lc)
printf ("LC_FUNCTION_STARTS");
break;
#endif
+#ifdef LC_MAIN
+ case LC_MAIN:
+ printf ("LC_MAIN ");
+ break;
+#endif
+#ifdef LC_SOURCE_VERSION
+ case LC_SOURCE_VERSION:
+ printf ("LC_SOURCE_VERSION");
+ break;
+#endif
+#ifdef LC_DYLIB_CODE_SIGN_DRS
+ case LC_DYLIB_CODE_SIGN_DRS:
+ printf ("LC_DYLIB_CODE_SIGN_DRS");
+ break;
+#endif
default:
printf ("unknown ");
}
@@ -798,8 +813,24 @@ copy_data_segment (struct load_command *lc)
file. */
if (strncmp (sectp->sectname, SECT_DATA, 16) == 0)
{
- if (!unexec_write (sectp->offset, (void *) sectp->addr, sectp->size))
+ extern char my_edata[];
+ unsigned long my_size;
+
+ /* The __data section is basically dumped from memory. But
+ initialized data in statically linked libraries are
+ copied from the input file. In particular,
+ add_image_hook.names and add_image_hook.pointers stored
+ by libarclite_macosx.a, are restored so that they will be
+ reinitialized when the dumped binary is executed. */
+ my_size = (unsigned long)my_edata - sectp->addr;
+ if (!(sectp->addr <= (unsigned long)my_edata
+ && my_size <= sectp->size))
+ unexec_error ("my_edata is not in section %s", SECT_DATA);
+ if (!unexec_write (sectp->offset, (void *) sectp->addr, my_size))
unexec_error ("cannot write section %s", SECT_DATA);
+ if (!unexec_copy (sectp->offset + my_size, old_file_offset + my_size,
+ sectp->size - my_size))
+ unexec_error ("cannot copy section %s", SECT_DATA);
if (!unexec_write (header_offset, sectp, sizeof (struct section)))
unexec_error ("cannot write section %s's header", SECT_DATA);
}
@@ -1147,8 +1178,9 @@ copy_dyld_info (struct load_command *lc, long delta)
#endif
#ifdef LC_FUNCTION_STARTS
-/* Copy a LC_FUNCTION_STARTS load command from the input file to the
- output file, adjusting the data offset field. */
+/* Copy a LC_FUNCTION_STARTS/LC_DYLIB_CODE_SIGN_DRS load command from
+ the input file to the output file, adjusting the data offset
+ field. */
static void
copy_linkedit_data (struct load_command *lc, long delta)
{
@@ -1242,6 +1274,9 @@ dump_it (void)
#endif
#ifdef LC_FUNCTION_STARTS
case LC_FUNCTION_STARTS:
+#ifdef LC_DYLIB_CODE_SIGN_DRS
+ case LC_DYLIB_CODE_SIGN_DRS:
+#endif
copy_linkedit_data (lca[i], linkedit_delta);
break;
#endif
diff --git a/test/ChangeLog b/test/ChangeLog
index d5bed2c8dfc..a9f6a7c0e9e 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,3 +1,15 @@
+2012-08-10 Glenn Morris <rgm@gnu.org>
+
+ * automated/files.el (files-test-disable-local-variables): New test.
+
+2012-08-08 Glenn Morris <rgm@gnu.org>
+
+ * automated/files.el: New file.
+
+2012-08-07 Glenn Morris <rgm@gnu.org>
+
+ * automated/Makefile.in (all): Fix typo.
+
2012-08-10 Dmitry Gutov <dgutov@yandex.ru>
* automated/ruby-mode-tests.el (ruby-should-indent):
diff --git a/test/automated/Makefile.in b/test/automated/Makefile.in
index 4f2e8a59e49..5f92e21d91a 100644
--- a/test/automated/Makefile.in
+++ b/test/automated/Makefile.in
@@ -55,7 +55,7 @@ setwins=subdirs=`find . -type d -print`; \
esac; \
done
-all: test
+all: check
doit:
diff --git a/test/automated/files.el b/test/automated/files.el
new file mode 100644
index 00000000000..e43d8c32f85
--- /dev/null
+++ b/test/automated/files.el
@@ -0,0 +1,52 @@
+;;; files.el --- tests for file handling.
+
+;; Copyright (C) 2012 Free Software Foundation, Inc.
+
+;; This file is part of GNU Emacs.
+
+;; GNU Emacs is free software: you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; GNU Emacs is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
+
+;;; Code:
+
+(require 'ert)
+
+(defvar files-test-var1 nil)
+
+(defun files-test-fun1 ()
+ (setq files-test-var1 t))
+
+(ert-deftest files-test-bug12155 ()
+ "Test for http://debbugs.gnu.org/12155 ."
+ (with-temp-buffer
+ (insert "text\n"
+ ";; Local Variables:\n"
+ ";; eval: (files-test-fun1)\n"
+ ";; End:\n")
+ (let ((enable-local-variables :safe)
+ (enable-local-eval 'maybe))
+ (hack-local-variables)
+ (should (eq files-test-var1 nil)))))
+
+(ert-deftest files-test-disable-local-variables ()
+ "Test that setting enable-local-variables to nil works."
+ (with-temp-buffer
+ (insert "text\n"
+ ";; Local Variables:\n"
+ ";; files-test-var1: t\n"
+ ";; End:\n")
+ (let ((enable-local-variables nil))
+ (hack-local-variables)
+ (should (eq files-test-var1 nil)))))
+
+;;; files.el ends here