emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r109804: Merge from emacs-24; up to r


From: Glenn Morris
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r109804: Merge from emacs-24; up to r108124
Date: Tue, 28 Aug 2012 09:01:59 -0700
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 109804 [merge]
committer: Glenn Morris <address@hidden>
branch nick: trunk
timestamp: Tue 2012-08-28 09:01:59 -0700
message:
  Merge from emacs-24; up to r108124
modified:
  lisp/ChangeLog
  lisp/files.el
  lisp/net/rcirc.el
  lisp/progmodes/hideif.el
  lisp/progmodes/hideshow.el
  lisp/progmodes/sh-script.el
  lisp/skeleton.el
  src/ChangeLog
  src/eval.c
  src/ralloc.c
  test/ChangeLog
  test/automated/files.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2012-08-28 09:01:54 +0000
+++ b/lisp/ChangeLog    2012-08-28 16:01:59 +0000
@@ -1,3 +1,35 @@
+2012-08-28  Leo Liu  <address@hidden>
+
+       * progmodes/sh-script.el (sh-dynamic-complete-functions): Adapt to
+       completion-at-point.  (Bug#12220)
+
+       * skeleton.el (skeleton-untabify): Change to nil (bug#12223).
+
+       * progmodes/sh-script.el (sh-indent-comment): Change to t (bug#12267).
+
+2012-08-28  Stefan Monnier  <address@hidden>
+
+       * files.el (safe-local-eval-forms): Fix before-save-hook entry to
+       be buffer-local; add delete-trailing-whitespace (bug#12259).
+
+2012-08-28  Jeremy Moore  <address@hidden>  (tiny change)
+
+       * progmodes/hideif.el (hif-compress-define-list):
+       Fix typo.  (Bug#11951)
+
+2012-08-28  Dan Nicolaescu  <address@hidden>
+
+       * progmodes/hideshow.el (hs-block-end-regexp): Restore lost
+       buffer local setting.
+
+       * net/rcirc.el (rcirc-split-message): Fix for buffer-local
+       rcirc-encode-coding-system.
+
+2012-08-28  Leo Liu  <address@hidden>
+
+       * net/rcirc.el (rcirc-split-message): New function.
+       (rcirc-send-message): Use it.  (Bug#12051)
+
 2012-08-28  Juri Linkov  <address@hidden>
 
        * info.el (Info-fontify-node): Hide empty lines at the end of
@@ -566,6 +598,7 @@
        * 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)
+       This is CVE-2012-3479.
 
 2012-08-10  Stefan Monnier  <address@hidden>
 

=== modified file 'lisp/files.el'
--- a/lisp/files.el     2012-08-15 16:29:11 +0000
+++ b/lisp/files.el     2012-08-28 16:01:59 +0000
@@ -2837,7 +2837,8 @@
   ;; This should be here at least as long as Emacs supports write-file-hooks.
   '((add-hook 'write-file-hooks 'time-stamp)
     (add-hook 'write-file-functions 'time-stamp)
-    (add-hook 'before-save-hook 'time-stamp))
+    (add-hook 'before-save-hook 'time-stamp nil t)
+    (add-hook 'before-save-hook 'delete-trailing-whitespace nil t))
   "Expressions that are considered safe in an `eval:' local variable.
 Add expressions to this list if you want Emacs to evaluate them, when
 they appear in an `eval' local variable specification, without first

=== modified file 'lisp/net/rcirc.el'
--- a/lisp/net/rcirc.el 2012-08-15 16:29:11 +0000
+++ b/lisp/net/rcirc.el 2012-08-28 16:01:59 +0000
@@ -802,26 +802,36 @@
 (defvar rcirc-max-message-length 420
   "Messages longer than this value will be split.")
 
+(defun rcirc-split-message (message)
+  "Split MESSAGE into chunks within `rcirc-max-message-length'."
+  ;; `rcirc-encode-coding-system' can have buffer-local value.
+  (let ((encoding rcirc-encode-coding-system))
+    (with-temp-buffer
+      (insert message)
+      (goto-char (point-min))
+      (let (result)
+       (while (not (eobp))
+         (goto-char (or (byte-to-position rcirc-max-message-length)
+                        (point-max)))
+         ;; max message length is 512 including CRLF
+         (while (and (not (bobp))
+                     (> (length (encode-coding-region
+                                 (point-min) (point) encoding t))
+                        rcirc-max-message-length))
+           (forward-char -1))
+         (push (delete-and-extract-region (point-min) (point)) result))
+       (nreverse result)))))
+
 (defun rcirc-send-message (process target message &optional noticep silent)
   "Send TARGET associated with PROCESS a privmsg with text MESSAGE.
 If NOTICEP is non-nil, send a notice instead of privmsg.
 If SILENT is non-nil, do not print the message in any irc buffer."
-  ;; max message length is 512 including CRLF
-  (let* ((response (if noticep "NOTICE" "PRIVMSG"))
-         (oversize (> (length message) rcirc-max-message-length))
-         (text (if oversize
-                   (substring message 0 rcirc-max-message-length)
-                 message))
-         (text (if (string= text "")
-                   " "
-                 text))
-         (more (if oversize
-                   (substring message rcirc-max-message-length))))
+  (let ((response (if noticep "NOTICE" "PRIVMSG")))
     (rcirc-get-buffer-create process target)
-    (rcirc-send-string process (concat response " " target " :" text))
-    (unless silent
-      (rcirc-print process (rcirc-nick process) response target text))
-    (when more (rcirc-send-message process target more noticep))))
+    (dolist (msg (rcirc-split-message message))
+      (rcirc-send-string process (concat response " " target " :" msg))
+      (unless silent
+       (rcirc-print process (rcirc-nick process) response target msg)))))
 
 (defvar rcirc-input-ring nil)
 (defvar rcirc-input-ring-index 0)

=== modified file 'lisp/progmodes/hideif.el'
--- a/lisp/progmodes/hideif.el  2012-01-19 07:21:25 +0000
+++ b/lisp/progmodes/hideif.el  2012-08-22 07:17:52 +0000
@@ -1003,7 +1003,7 @@
   "Compress the define list ENV into a list of defined symbols only."
   (let ((new-defs nil))
     (dolist (def env new-defs)
-      (if (hif-lookup (car def)) (push (car env) new-defs)))))
+      (if (hif-lookup (car def)) (push (car def) new-defs)))))
 
 (defun hide-ifdef-set-define-alist (name)
   "Set the association for NAME to `hide-ifdef-env'."

=== modified file 'lisp/progmodes/hideshow.el'
--- a/lisp/progmodes/hideshow.el        2012-04-10 23:34:25 +0000
+++ b/lisp/progmodes/hideshow.el        2012-08-28 16:01:59 +0000
@@ -408,6 +408,8 @@
 
 (defvar hs-block-end-regexp nil
   "Regexp for end of block.")
+(make-variable-buffer-local 'hs-block-end-regexp)
+
 
 (defvar hs-forward-sexp-func 'forward-sexp
   "Function used to do a `forward-sexp'.

=== modified file 'lisp/progmodes/sh-script.el'
--- a/lisp/progmodes/sh-script.el       2012-08-15 16:29:11 +0000
+++ b/lisp/progmodes/sh-script.el       2012-08-28 16:01:59 +0000
@@ -202,6 +202,11 @@
   (require 'comint))
 (require 'executable)
 
+(autoload 'comint-completion-at-point "comint")
+(autoload 'comint-filename-completion "comint")
+(autoload 'shell-command-completion "shell")
+(autoload 'shell-environment-variable-completion "shell")
+
 (defvar font-lock-comment-face)
 (defvar font-lock-set-defaults)
 (defvar font-lock-string-face)
@@ -470,7 +475,6 @@
     (define-key map "\C-\M-x" 'sh-execute-region)
     (define-key map "\C-c\C-x" 'executable-interpret)
 
-    (define-key map [remap complete-tag] 'comint-dynamic-complete)
     (define-key map [remap delete-backward-char]
       'backward-delete-char-untabify)
     (define-key map "\C-c:" 'sh-set-shell)
@@ -553,9 +557,9 @@
   "Value to use for `skeleton-pair-default-alist' in Shell-Script mode.")
 
 (defcustom sh-dynamic-complete-functions
-  '(shell-dynamic-complete-environment-variable
-    shell-dynamic-complete-command
-    comint-dynamic-complete-filename)
+  '(shell-environment-variable-completion
+    shell-command-completion
+    comint-filename-completion)
   "Functions for doing TAB dynamic completion."
   :type '(repeat function)
   :group 'sh-script)
@@ -1187,7 +1191,7 @@
   :group 'sh-indentation)
 (put 'sh-basic-offset 'safe-local-variable 'integerp)
 
-(defcustom sh-indent-comment nil
+(defcustom sh-indent-comment t
   "How a comment line is to be indented.
 nil means leave it as it is;
 t  means indent it as a normal line, aligning it to previous non-blank
@@ -1198,6 +1202,7 @@
          (const :tag "Indent as a normal line."  t)
          (integer :menu-tag "Indent to this col (0 means first col)."
                   :tag "Indent to column number.") )
+  :version "24.3"
   :group 'sh-indentation)
 
 
@@ -1485,6 +1490,7 @@
   (set (make-local-variable 'local-abbrev-table) sh-mode-abbrev-table)
   (set (make-local-variable 'comint-dynamic-complete-functions)
        sh-dynamic-complete-functions)
+  (add-hook 'completion-at-point-functions 'comint-completion-at-point nil t)
   ;; we can't look if previous line ended with `\'
   (set (make-local-variable 'comint-prompt-regexp) "^[ \t]*")
   (set (make-local-variable 'imenu-case-fold-search) nil)
@@ -4109,20 +4115,6 @@
 
 ;; various other commands
 
-(autoload 'comint-dynamic-complete "comint"
-  "Dynamically perform completion at point." t)
-
-(autoload 'shell-dynamic-complete-command "shell"
-  "Dynamically complete the command at point." t)
-
-(autoload 'comint-dynamic-complete-filename "comint"
-  "Dynamically complete the filename at point." t)
-
-(autoload 'shell-dynamic-complete-environment-variable "shell"
-  "Dynamically complete the environment variable at point." t)
-
-
-
 (defun sh-beginning-of-command ()
   ;; FIXME: Redefine using SMIE.
   "Move point to successive beginnings of commands."

=== modified file 'lisp/skeleton.el'
--- a/lisp/skeleton.el  2012-05-18 01:46:20 +0000
+++ b/lisp/skeleton.el  2012-08-28 16:01:59 +0000
@@ -77,7 +77,7 @@
   "Function for transforming a skeleton proxy's aliases' variable value.")
 (defvaralias 'skeleton-filter 'skeleton-filter-function)
 
-(defvar skeleton-untabify t
+(defvar skeleton-untabify nil          ; bug#12223
   "When non-nil untabifies when deleting backwards with element -ARG.")
 
 (defvar skeleton-newline-indent-rigidly nil

=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2012-08-28 14:09:43 +0000
+++ b/src/ChangeLog     2012-08-28 16:01:59 +0000
@@ -1,3 +1,12 @@
+2012-08-28  Eli Zaretskii  <address@hidden>
+
+       * ralloc.c (free_bloc): Don't dereference a 'heap' structure if it
+       is not one of the heaps we manage.  (Bug#12242)
+
+2012-08-28  Glenn Morris  <address@hidden>
+
+       * eval.c (Fcalled_interactively_p): Doc fix.  (Bug#11747)
+
 2012-08-28  Martin Rudalics  <address@hidden>
 
        * window.c (Fset_window_configuration): Remove handling of

=== modified file 'src/eval.c'
--- a/src/eval.c        2012-08-26 03:30:56 +0000
+++ b/src/eval.c        2012-08-28 16:01:59 +0000
@@ -544,11 +544,10 @@
 you're making a mistake.  Think: what do you want to do when the
 command is called from a keyboard macro?
 
-This function is meant for implementing advice and other
-function-modifying features.  Instead of using this, it is sometimes
-cleaner to give your function an extra optional argument whose
-`interactive' spec specifies non-nil unconditionally (\"p\" is a good
-way to do this), or via (not (or executing-kbd-macro noninteractive)).  */)
+Instead of using this function, it is sometimes cleaner to give your
+function an extra optional argument whose `interactive' spec specifies
+non-nil unconditionally (\"p\" is a good way to do this), or via
+\(not (or executing-kbd-macro noninteractive)).  */)
   (Lisp_Object kind)
 {
   return ((INTERACTIVE || !EQ (kind, intern ("interactive")))

=== modified file 'src/ralloc.c'
--- a/src/ralloc.c      2012-07-05 18:35:48 +0000
+++ b/src/ralloc.c      2012-08-28 16:01:59 +0000
@@ -670,6 +670,7 @@
 free_bloc (bloc_ptr bloc)
 {
   heap_ptr heap = bloc->heap;
+  heap_ptr h;
 
   if (r_alloc_freeze_level)
     {
@@ -699,20 +700,38 @@
       bloc->prev->next = bloc->next;
     }
 
-  /* Update the records of which blocs are in HEAP.  */
-  if (heap->first_bloc == bloc)
-    {
-      if (bloc->next != 0 && bloc->next->heap == heap)
-       heap->first_bloc = bloc->next;
-      else
-       heap->first_bloc = heap->last_bloc = NIL_BLOC;
-    }
-  if (heap->last_bloc == bloc)
-    {
-      if (bloc->prev != 0 && bloc->prev->heap == heap)
-       heap->last_bloc = bloc->prev;
-      else
-       heap->first_bloc = heap->last_bloc = NIL_BLOC;
+  /* Sometimes, 'heap' obtained from bloc->heap above is not really a
+     'heap' structure.  It can even be beyond the current break point,
+     which will cause crashes when we dereference it below (see
+     bug#12242).  Evidently, the reason is bloc allocations done while
+     use_relocatable_buffers was non-positive, because additional
+     memory we get then is not recorded in the heaps we manage.  If
+     bloc->heap records such a "heap", we cannot (and don't need to)
+     update its records.  So we validate the 'heap' value by making
+     sure it is one of the heaps we manage via the heaps linked list,
+     and don't touch a 'heap' that isn't found there.  This avoids
+     accessing memory we know nothing about.  */
+  for (h = first_heap; h != NIL_HEAP; h = h->next)
+    if (heap == h)
+      break;
+
+  if (h)
+    {
+      /* Update the records of which blocs are in HEAP.  */
+      if (heap->first_bloc == bloc)
+       {
+         if (bloc->next != 0 && bloc->next->heap == heap)
+           heap->first_bloc = bloc->next;
+         else
+           heap->first_bloc = heap->last_bloc = NIL_BLOC;
+       }
+      if (heap->last_bloc == bloc)
+       {
+         if (bloc->prev != 0 && bloc->prev->heap == heap)
+           heap->last_bloc = bloc->prev;
+         else
+           heap->first_bloc = heap->last_bloc = NIL_BLOC;
+       }
     }
 
   relinquish ();

=== modified file 'test/ChangeLog'
--- a/test/ChangeLog    2012-08-19 16:19:05 +0000
+++ b/test/ChangeLog    2012-08-28 16:01:59 +0000
@@ -1,3 +1,8 @@
+2012-08-28  Chong Yidong  <address@hidden>
+
+       * automated/files.el: Test every combination of values for
+       enable-local-variables and enable-local-eval.
+
 2012-08-19  Chong Yidong  <address@hidden>
 
        * redisplay-testsuite.el (test-redisplay): Use switch-to-buffer.

=== modified file 'test/automated/files.el'
--- a/test/automated/files.el   2012-08-10 07:13:06 +0000
+++ b/test/automated/files.el   2012-08-14 04:04:25 +0000
@@ -21,32 +21,129 @@
 
 (require 'ert)
 
-(defvar files-test-var1 nil)
+;; Set to t if the local variable was set, `query' if the query was
+;; triggered.
+(defvar files-test-result)
+
+(defvar files-test-safe-result)
+(put 'files-test-safe-result 'safe-local-variable 'booleanp)
 
 (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)))))
+  (setq files-test-result t))
+
+;; Test combinations:
+;; `enable-local-variables' t, nil, :safe, :all, or something else.
+;; `enable-local-eval' t, nil, or something else.
+
+(defvar files-test-local-variable-data
+  ;; Unsafe eval form
+  '((("eval: (files-test-fun1)")
+     (t t         (eq files-test-result t))
+     (t nil       (eq files-test-result nil))
+     (t maybe     (eq files-test-result 'query))
+     (nil t       (eq files-test-result nil))
+     (nil nil     (eq files-test-result nil))
+     (nil maybe   (eq files-test-result nil))
+     (:safe t     (eq files-test-result nil))
+     (:safe nil   (eq files-test-result nil))
+     (:safe maybe (eq files-test-result nil))
+     (:all t      (eq files-test-result t))
+     (:all nil    (eq files-test-result nil))
+     (:all maybe  (eq files-test-result t)) ; This combination is ambiguous.
+     (maybe t     (eq files-test-result 'query))
+     (maybe nil   (eq files-test-result 'query))
+     (maybe maybe (eq files-test-result 'query)))
+    ;; Unsafe local variable value
+    (("files-test-result: t")
+     (t t         (eq files-test-result 'query))
+     (t nil       (eq files-test-result 'query))
+     (t maybe     (eq files-test-result 'query))
+     (nil t       (eq files-test-result nil))
+     (nil nil     (eq files-test-result nil))
+     (nil maybe   (eq files-test-result nil))
+     (:safe t     (eq files-test-result nil))
+     (:safe nil   (eq files-test-result nil))
+     (:safe maybe (eq files-test-result nil))
+     (:all t      (eq files-test-result t))
+     (:all nil    (eq files-test-result t))
+     (:all maybe  (eq files-test-result t))
+     (maybe t     (eq files-test-result 'query))
+     (maybe nil   (eq files-test-result 'query))
+     (maybe maybe (eq files-test-result 'query)))
+    ;; Safe local variable
+    (("files-test-safe-result: t")
+     (t t         (eq files-test-safe-result t))
+     (t nil       (eq files-test-safe-result t))
+     (t maybe     (eq files-test-safe-result t))
+     (nil t       (eq files-test-safe-result nil))
+     (nil nil     (eq files-test-safe-result nil))
+     (nil maybe   (eq files-test-safe-result nil))
+     (:safe t     (eq files-test-safe-result t))
+     (:safe nil   (eq files-test-safe-result t))
+     (:safe maybe (eq files-test-safe-result t))
+     (:all t      (eq files-test-safe-result t))
+     (:all nil    (eq files-test-safe-result t))
+     (:all maybe  (eq files-test-safe-result t))
+     (maybe t     (eq files-test-result 'query))
+     (maybe nil   (eq files-test-result 'query))
+     (maybe maybe (eq files-test-result 'query)))
+    ;; Safe local variable with unsafe value
+    (("files-test-safe-result: 1")
+     (t t         (eq files-test-result 'query))
+     (t nil       (eq files-test-result 'query))
+     (t maybe     (eq files-test-result 'query))
+     (nil t       (eq files-test-safe-result nil))
+     (nil nil     (eq files-test-safe-result nil))
+     (nil maybe   (eq files-test-safe-result nil))
+     (:safe t     (eq files-test-safe-result nil))
+     (:safe nil   (eq files-test-safe-result nil))
+     (:safe maybe (eq files-test-safe-result nil))
+     (:all t      (eq files-test-safe-result 1))
+     (:all nil    (eq files-test-safe-result 1))
+     (:all maybe  (eq files-test-safe-result 1))
+     (maybe t     (eq files-test-result 'query))
+     (maybe nil   (eq files-test-result 'query))
+     (maybe maybe (eq files-test-result 'query))))
+  "List of file-local variable tests.
+Each list element should have the form
+
+  (LOCAL-VARS-LIST . TEST-LIST)
+
+where LOCAL-VARS-LISTS should be a list of local variable
+definitions (strings) and TEST-LIST is a list of tests to
+perform.  Each entry of TEST-LIST should have the form
+
+ (ENABLE-LOCAL-VARIABLES ENABLE-LOCAL-EVAL FORM)
+
+where ENABLE-LOCAL-VARIABLES is the value to assign to
+`enable-local-variables', ENABLE-LOCAL-EVAL is the value to
+assign to `enable-local-eval', and FORM is a desired `should'
+form.")
+
+(defun file-test--do-local-variables-test (str test-settings)
+  (with-temp-buffer
+    (insert str)
+    (let ((enable-local-variables (nth 0 test-settings))
+         (enable-local-eval      (nth 1 test-settings))
+         (files-test-result nil)
+         (files-test-queried nil)
+         (files-test-safe-result nil))
+      (hack-local-variables)
+      (eval (nth 2 test-settings)))))
+
+(ert-deftest files-test-local-variables ()
+  "Test the file-local variables implementation."
+  (unwind-protect
+      (progn
+       (defadvice hack-local-variables-confirm (around files-test activate)
+         (setq files-test-result 'query)
+         nil)
+       (dolist (test files-test-local-variable-data)
+         (let ((str (concat "text\n\n;; Local Variables:\n;; "
+                            (mapconcat 'identity (car test) "\n;; ")
+                            "\n;; End:\n")))
+           (dolist (subtest (cdr test))
+             (should (file-test--do-local-variables-test str subtest))))))
+    (ad-disable-advice 'hack-local-variables-confirm 'around 'files-test)))
 
 ;;; files.el ends here


reply via email to

[Prev in Thread] Current Thread [Next in Thread]