]> git.eshelyaron.com Git - emacs.git/commitdiff
Give dired-actual-switches a safe-local-variable property. (Bug#3230)
authorGlenn Morris <rgm@gnu.org>
Tue, 1 Mar 2011 03:25:24 +0000 (19:25 -0800)
committerGlenn Morris <rgm@gnu.org>
Tue, 1 Mar 2011 03:25:24 +0000 (19:25 -0800)
* lisp/dired.el (dired-safe-switches-p): Beef it up.
(dired-actual-switches): Use it for the safe-local-variable property.

lisp/ChangeLog
lisp/dired.el

index c4154b9a56e7c5479f94b378a3c9ad64d71b2484..2b42e0f24a12a384986b94b816d4509a6f78f4b8 100644 (file)
@@ -1,3 +1,8 @@
+2011-03-01  Glenn Morris  <rgm@gnu.org>
+
+       * dired.el (dired-safe-switches-p): Beef it up.
+       (dired-actual-switches): Use it for the safe-local prop.  (Bug#3230)
+
 2011-03-01  Stefan Monnier  <monnier@iro.umontreal.ca>
 
        * dired.el (dired-safe-switches-p): New function.
index 4b9bc19c8d9affb86f3a4ddeb609d267338ac579..c113f0cb2f413d6715484ff42d206ca351042a8c 100644 (file)
@@ -249,12 +249,19 @@ Local to each dired buffer.  May be a list, in which case the car is the
 directory name and the cdr is the list of files to mention.
 The directory name must be absolute, but need not be fully expanded.")
 
+;; Beware of "-l;reboot" etc.  See bug#3230.
 (defun dired-safe-switches-p (switches)
-  (string-match "\\`[- [:alnum:]]+\\'" switches))
+  "Return non-nil if string SWITCHES does not look risky for dired."
+  (or (not switches)
+      (and (stringp switches)
+           (< (length switches) 100)    ; arbitrary
+           (string-match "\\` *-[- [:alnum:]]+\\'" switches))))
 
 (defvar dired-actual-switches nil
   "The value of `dired-listing-switches' used to make this buffer's text.")
 
+(put 'dired-actual-switches 'safe-local-variable 'dired-safe-switches-p)
+
 (defvar dired-re-inode-size "[0-9 \t]*"
   "Regexp for optional initial inode and file size as made by `ls -i -s'.")
 
@@ -3617,7 +3624,7 @@ Ask means pop up a menu for the user to select one of copy, move or link."
 ;;;;;;  dired-run-shell-command dired-do-shell-command dired-do-async-shell-command
 ;;;;;;  dired-clean-directory dired-do-print dired-do-touch dired-do-chown
 ;;;;;;  dired-do-chgrp dired-do-chmod dired-compare-directories dired-backup-diff
-;;;;;;  dired-diff) "dired-aux" "dired-aux.el" "9d6333fab9c0f1b49e0bf2a536b8f245")
+;;;;;;  dired-diff) "dired-aux" "dired-aux.el" "154cdfbf451aedec60c5012b625ff329")
 ;;; Generated autoloads from dired-aux.el
 
 (autoload 'dired-diff "dired-aux" "\
@@ -4076,7 +4083,7 @@ true then the type of the file linked to by FILE is printed instead.
 ;;;***
 \f
 ;;;### (autoloads (dired-do-relsymlink dired-jump) "dired-x" "dired-x.el"
-;;;;;;  "c24f202ea049990539accfd4c2c73fe9")
+;;;;;;  "3b8851132739ab3f9054bf639873c53e")
 ;;; Generated autoloads from dired-x.el
 
 (autoload 'dired-jump "dired-x" "\