emacs-pretest-bug
[Top][All Lists]
Advanced

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

Re: Unsafe variable in a saved *compilation* buffer


From: Chong Yidong
Subject: Re: Unsafe variable in a saved *compilation* buffer
Date: Sat, 24 Mar 2007 13:25:26 -0400
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.96 (gnu/linux)

Richard Stallman <address@hidden> writes:

>     Presumably if it's saved, it'll be saved in that same directory, so it'll
>     work just as well without the default-directory file-local variable.
>
> The user could save it anywhere.  He might not want to save it
> in the directory with the source files.
>
> ISTR that I added this because I ran into problems without it.

I think the following patch, which saves compilation-directory rather
than default-directory (and makes compilation-directory a safe local
variable), solves the original problem, as well as your problem with
saving compile logs in different directories, without requiring
default-directory to be safe (which might be a security risk).

Any objections?

*** emacs/lisp/files.el.~1.891.~        2007-03-21 10:31:23.000000000 -0400
--- emacs/lisp/files.el 2007-03-24 13:18:48.000000000 -0400
***************
*** 2435,2441 ****
  (mapc (lambda (pair)
        (put (car pair) 'safe-local-variable (cdr pair)))
        '((buffer-read-only                . booleanp) ;; C source code
-       (default-directory               . stringp)  ;; C source code
        (fill-column                     . integerp) ;; C source code
        (indent-tabs-mode                . booleanp) ;; C source code
        (left-margin                     . integerp) ;; C source code
--- 2435,2440 ----
*** emacs/lisp/progmodes/compile.el.~1.418.~    2007-03-18 10:22:44.000000000 
-0400
--- emacs/lisp/progmodes/compile.el     2007-03-24 13:22:06.000000000 -0400
***************
*** 391,396 ****
--- 391,397 ----
                    ,(expand-file-name "compilation.txt" data-directory))
    :group 'compilation)
  
+ ;;;###autoload(put 'compilation-directory 'safe-local-variable 'stringp)
  (defvar compilation-directory nil
    "Directory to restore to when doing `recompile'.")
  
***************
*** 1041,1047 ****
                 highlight-regexp))
        ;; Output a mode setter, for saving and later reloading this buffer.
        (insert "-*- mode: " name-of-mode
!               "; default-directory: " (prin1-to-string default-directory)
                " -*-\n"
                (format "%s started at %s\n\n"
                        mode-name
--- 1042,1048 ----
                 highlight-regexp))
        ;; Output a mode setter, for saving and later reloading this buffer.
        (insert "-*- mode: " name-of-mode
!               "; compilation-directory: " (prin1-to-string default-directory)
                " -*-\n"
                (format "%s started at %s\n\n"
                        mode-name





reply via email to

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