aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChong Yidong2012-08-11 10:13:55 +0800
committerChong Yidong2012-08-11 10:13:55 +0800
commit5725bd2cc0e691dadc31bd958f210b1bbcf17c49 (patch)
treea8faec22f21eff83d918076adcc9c8c49c4cc820
parent5723992258a8025e29ba9fcae923182fb5456426 (diff)
parent711f4590cddbc83c509c1c5e852ef4e528a39780 (diff)
downloademacs-5725bd2cc0e691dadc31bd958f210b1bbcf17c49.tar.gz
emacs-5725bd2cc0e691dadc31bd958f210b1bbcf17c49.zip
Merge from emacs-24; up to 2012-05-02T11:38:01Z!lekktu@gmail.com
-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 @@
12012-08-10 Glenn Morris <rgm@gnu.org>
2
3 * bzrmerge.el (bzrmerge-resolve): Disable local eval:.
4
12012-08-07 Dmitry Antipov <dmantipov@yandex.ru> 52012-08-07 Dmitry Antipov <dmantipov@yandex.ru>
2 6
3 * coccinelle/overlay.cocci, coccinelle/symbol.cocci: Remove. 7 * 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,
160 (unless (file-exists-p file) (error "Bzrmerge-resolve: Can't find %s" file)) 160 (unless (file-exists-p file) (error "Bzrmerge-resolve: Can't find %s" file))
161 (with-demoted-errors 161 (with-demoted-errors
162 (let ((exists (find-buffer-visiting file))) 162 (let ((exists (find-buffer-visiting file)))
163 (with-current-buffer (let ((enable-local-variables :safe)) 163 (with-current-buffer (let ((enable-local-variables :safe)
164 (enable-local-eval nil))
164 (find-file-noselect file)) 165 (find-file-noselect file))
165 (if (buffer-modified-p) 166 (if (buffer-modified-p)
166 (error "Unsaved changes in %s" (current-buffer))) 167 (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 @@
12012-08-10 Glenn Morris <rgm@gnu.org>
2
3 * emacs-lisp/copyright.el (copyright-update-directory): Logic fix.
4
5 * tutorial.el (help-with-tutorial):
6 * emacs-lisp/copyright.el (copyright-update-directory):
7 * emacs-lisp/autoload.el (autoload-find-generated-file)
8 (autoload-find-file): Disable local eval: (for insurance).
9
102012-08-07 Glenn Morris <rgm@gnu.org>
11
12 * files.el (hack-local-variables-filter): If an eval: form is not
13 known to be safe, and enable-local-variables is :safe, then ignore
14 the form totally, as is done for non-eval forms. (Bug#12155)
15
12012-08-10 Stefan Monnier <monnier@iro.umontreal.ca> 162012-08-10 Stefan Monnier <monnier@iro.umontreal.ca>
2 17
3 * emacs-lisp/rx.el (rx-constituents): Don't define as constant. 18 * 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."
228(defun autoload-find-generated-file () 228(defun autoload-find-generated-file ()
229 "Visit the autoload file for the current buffer, and return its buffer. 229 "Visit the autoload file for the current buffer, and return its buffer.
230If a buffer is visiting the desired autoload file, return it." 230If a buffer is visiting the desired autoload file, return it."
231 (let ((enable-local-variables :safe)) 231 (let ((enable-local-variables :safe)
232 (enable-local-eval nil))
232 ;; We used to use `raw-text' to read this file, but this causes 233 ;; We used to use `raw-text' to read this file, but this causes
233 ;; problems when the file contains non-ASCII characters. 234 ;; problems when the file contains non-ASCII characters.
234 (find-file-noselect 235 (find-file-noselect
@@ -382,7 +383,8 @@ which lists the file name and which functions are in it, etc."
382 (emacs-lisp-mode) 383 (emacs-lisp-mode)
383 (setq default-directory (file-name-directory file)) 384 (setq default-directory (file-name-directory file))
384 (insert-file-contents file nil) 385 (insert-file-contents file nil)
385 (let ((enable-local-variables :safe)) 386 (let ((enable-local-variables :safe)
387 (enable-local-eval nil))
386 (hack-local-variables)) 388 (hack-local-variables))
387 (current-buffer))) 389 (current-buffer)))
388 390
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."
362 (dolist (file (directory-files directory t match nil)) 362 (dolist (file (directory-files directory t match nil))
363 (unless (file-directory-p file) 363 (unless (file-directory-p file)
364 (message "Updating file `%s'" file) 364 (message "Updating file `%s'" file)
365 (find-file file) 365 ;; FIXME we should not use find-file+save+kill.
366 (let ((inhibit-read-only t) 366 (let ((enable-local-variables :safe)
367 (enable-local-variables :safe) 367 (enable-local-eval nil))
368 copyright-query) 368 (find-file file))
369 (let ((inhibit-read-only t))
369 (if fix 370 (if fix
370 (copyright-fix-years) 371 (copyright-fix-years)
371 (copyright-update))) 372 (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."
3102 ;; Obey `enable-local-eval'. 3102 ;; Obey `enable-local-eval'.
3103 ((eq var 'eval) 3103 ((eq var 'eval)
3104 (when enable-local-eval 3104 (when enable-local-eval
3105 (push elt all-vars) 3105 (let ((safe (or (hack-one-local-variable-eval-safep
3106 (or (eq enable-local-eval t) 3106 (eval (quote val)))
3107 (hack-one-local-variable-eval-safep (eval (quote val))) 3107 ;; In case previously marked safe (bug#5636).
3108 (safe-local-variable-p var val) 3108 (safe-local-variable-p var val))))
3109 (push elt unsafe-vars)))) 3109 ;; If not safe and e-l-v = :safe, ignore totally.
3110 (when (or safe (not (eq enable-local-variables :safe)))
3111 (push elt all-vars)
3112 (or (eq enable-local-eval t)
3113 safe
3114 (push elt unsafe-vars))))))
3110 ;; Ignore duplicates (except `mode') in the present list. 3115 ;; Ignore duplicates (except `mode') in the present list.
3111 ((and (assq var all-vars) (not (eq var 'mode))) nil) 3116 ((and (assq var all-vars) (not (eq var 'mode))) nil)
3112 ;; Accept known-safe variables. 3117 ;; 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? "))
829 (if old-tut-file 829 (if old-tut-file
830 (progn 830 (progn
831 (insert-file-contents (tutorial--saved-file)) 831 (insert-file-contents (tutorial--saved-file))
832 (let ((enable-local-variables :safe)) 832 (let ((enable-local-variables :safe)
833 (enable-local-eval nil))
833 (hack-local-variables)) 834 (hack-local-variables))
834 ;; FIXME? What we actually want is to ignore dir-locals (?). 835 ;; FIXME? What we actually want is to ignore dir-locals (?).
835 (setq buffer-read-only nil) ; bug#11118 836 (setq buffer-read-only nil) ; bug#11118
@@ -848,7 +849,8 @@ Run the Viper tutorial? "))
848 (goto-char tutorial--point-before-chkeys) 849 (goto-char tutorial--point-before-chkeys)
849 (setq tutorial--point-before-chkeys (point-marker))) 850 (setq tutorial--point-before-chkeys (point-marker)))
850 (insert-file-contents (expand-file-name filename tutorial-directory)) 851 (insert-file-contents (expand-file-name filename tutorial-directory))
851 (let ((enable-local-variables :safe)) 852 (let ((enable-local-variables :safe)
853 (enable-local-eval nil))
852 (hack-local-variables)) 854 (hack-local-variables))
853 ;; FIXME? What we actually want is to ignore dir-locals (?). 855 ;; FIXME? What we actually want is to ignore dir-locals (?).
854 (setq buffer-read-only nil) ; bug#11118 856 (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 @@
12012-08-08 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
2
3 * unexmacosx.c (copy_data_segment): Copy initialized data in
4 statically linked libraries from input file rather than memory.
5
62012-08-07 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
7
8 * unexmacosx.c (print_load_command_name): Add cases LC_MAIN,
9 LC_SOURCE_VERSION, and LC_DYLIB_CODE_SIGN_DRS.
10 (dump_it) [LC_DYLIB_CODE_SIGN_DRS]: Call copy_linkedit_data.
11
12012-08-10 Glenn Morris <rgm@gnu.org> 122012-08-10 Glenn Morris <rgm@gnu.org>
2 13
3 * conf_post.h (IF_LINT, lint_assume): Move here from lisp.h. 14 * 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)
607 printf ("LC_FUNCTION_STARTS"); 607 printf ("LC_FUNCTION_STARTS");
608 break; 608 break;
609#endif 609#endif
610#ifdef LC_MAIN
611 case LC_MAIN:
612 printf ("LC_MAIN ");
613 break;
614#endif
615#ifdef LC_SOURCE_VERSION
616 case LC_SOURCE_VERSION:
617 printf ("LC_SOURCE_VERSION");
618 break;
619#endif
620#ifdef LC_DYLIB_CODE_SIGN_DRS
621 case LC_DYLIB_CODE_SIGN_DRS:
622 printf ("LC_DYLIB_CODE_SIGN_DRS");
623 break;
624#endif
610 default: 625 default:
611 printf ("unknown "); 626 printf ("unknown ");
612 } 627 }
@@ -798,8 +813,24 @@ copy_data_segment (struct load_command *lc)
798 file. */ 813 file. */
799 if (strncmp (sectp->sectname, SECT_DATA, 16) == 0) 814 if (strncmp (sectp->sectname, SECT_DATA, 16) == 0)
800 { 815 {
801 if (!unexec_write (sectp->offset, (void *) sectp->addr, sectp->size)) 816 extern char my_edata[];
817 unsigned long my_size;
818
819 /* The __data section is basically dumped from memory. But
820 initialized data in statically linked libraries are
821 copied from the input file. In particular,
822 add_image_hook.names and add_image_hook.pointers stored
823 by libarclite_macosx.a, are restored so that they will be
824 reinitialized when the dumped binary is executed. */
825 my_size = (unsigned long)my_edata - sectp->addr;
826 if (!(sectp->addr <= (unsigned long)my_edata
827 && my_size <= sectp->size))
828 unexec_error ("my_edata is not in section %s", SECT_DATA);
829 if (!unexec_write (sectp->offset, (void *) sectp->addr, my_size))
802 unexec_error ("cannot write section %s", SECT_DATA); 830 unexec_error ("cannot write section %s", SECT_DATA);
831 if (!unexec_copy (sectp->offset + my_size, old_file_offset + my_size,
832 sectp->size - my_size))
833 unexec_error ("cannot copy section %s", SECT_DATA);
803 if (!unexec_write (header_offset, sectp, sizeof (struct section))) 834 if (!unexec_write (header_offset, sectp, sizeof (struct section)))
804 unexec_error ("cannot write section %s's header", SECT_DATA); 835 unexec_error ("cannot write section %s's header", SECT_DATA);
805 } 836 }
@@ -1147,8 +1178,9 @@ copy_dyld_info (struct load_command *lc, long delta)
1147#endif 1178#endif
1148 1179
1149#ifdef LC_FUNCTION_STARTS 1180#ifdef LC_FUNCTION_STARTS
1150/* Copy a LC_FUNCTION_STARTS load command from the input file to the 1181/* Copy a LC_FUNCTION_STARTS/LC_DYLIB_CODE_SIGN_DRS load command from
1151 output file, adjusting the data offset field. */ 1182 the input file to the output file, adjusting the data offset
1183 field. */
1152static void 1184static void
1153copy_linkedit_data (struct load_command *lc, long delta) 1185copy_linkedit_data (struct load_command *lc, long delta)
1154{ 1186{
@@ -1242,6 +1274,9 @@ dump_it (void)
1242#endif 1274#endif
1243#ifdef LC_FUNCTION_STARTS 1275#ifdef LC_FUNCTION_STARTS
1244 case LC_FUNCTION_STARTS: 1276 case LC_FUNCTION_STARTS:
1277#ifdef LC_DYLIB_CODE_SIGN_DRS
1278 case LC_DYLIB_CODE_SIGN_DRS:
1279#endif
1245 copy_linkedit_data (lca[i], linkedit_delta); 1280 copy_linkedit_data (lca[i], linkedit_delta);
1246 break; 1281 break;
1247#endif 1282#endif
diff --git a/test/ChangeLog b/test/ChangeLog
index d5bed2c8dfc..a9f6a7c0e9e 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,3 +1,15 @@
12012-08-10 Glenn Morris <rgm@gnu.org>
2
3 * automated/files.el (files-test-disable-local-variables): New test.
4
52012-08-08 Glenn Morris <rgm@gnu.org>
6
7 * automated/files.el: New file.
8
92012-08-07 Glenn Morris <rgm@gnu.org>
10
11 * automated/Makefile.in (all): Fix typo.
12
12012-08-10 Dmitry Gutov <dgutov@yandex.ru> 132012-08-10 Dmitry Gutov <dgutov@yandex.ru>
2 14
3 * automated/ruby-mode-tests.el (ruby-should-indent): 15 * 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`; \
55 esac; \ 55 esac; \
56 done 56 done
57 57
58all: test 58all: check
59 59
60doit: 60doit:
61 61
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 @@
1;;; files.el --- tests for file handling.
2
3;; Copyright (C) 2012 Free Software Foundation, Inc.
4
5;; This file is part of GNU Emacs.
6
7;; GNU Emacs is free software: you can redistribute it and/or modify
8;; it under the terms of the GNU General Public License as published by
9;; the Free Software Foundation, either version 3 of the License, or
10;; (at your option) any later version.
11
12;; GNU Emacs is distributed in the hope that it will be useful,
13;; but WITHOUT ANY WARRANTY; without even the implied warranty of
14;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15;; GNU General Public License for more details.
16
17;; You should have received a copy of the GNU General Public License
18;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
19
20;;; Code:
21
22(require 'ert)
23
24(defvar files-test-var1 nil)
25
26(defun files-test-fun1 ()
27 (setq files-test-var1 t))
28
29(ert-deftest files-test-bug12155 ()
30 "Test for http://debbugs.gnu.org/12155 ."
31 (with-temp-buffer
32 (insert "text\n"
33 ";; Local Variables:\n"
34 ";; eval: (files-test-fun1)\n"
35 ";; End:\n")
36 (let ((enable-local-variables :safe)
37 (enable-local-eval 'maybe))
38 (hack-local-variables)
39 (should (eq files-test-var1 nil)))))
40
41(ert-deftest files-test-disable-local-variables ()
42 "Test that setting enable-local-variables to nil works."
43 (with-temp-buffer
44 (insert "text\n"
45 ";; Local Variables:\n"
46 ";; files-test-var1: t\n"
47 ";; End:\n")
48 (let ((enable-local-variables nil))
49 (hack-local-variables)
50 (should (eq files-test-var1 nil)))))
51
52;;; files.el ends here