+2009-12-17 Juri Linkov <juri@jurta.org>
+
+ Make `dired-diff' more safe. (Bug#5225)
+
+ * dired-aux.el (dired-diff): Signal an error when `file' equals to
+ `current' or when `file' is a directory of the `current' file.
+
2009-12-17 Andreas Schwab <schwab@linux-m68k.org>
* emacs-lisp/autoload.el (batch-update-autoloads): Only exclude
(if (stringp diff-switches)
diff-switches
(mapconcat 'identity diff-switches " ")))))))
- (diff file (dired-get-filename t) switches))
+ (let ((current (dired-get-filename t)))
+ (when (or (equal (expand-file-name file)
+ (expand-file-name current))
+ (and (file-directory-p file)
+ (equal (expand-file-name current file)
+ (expand-file-name current))))
+ (error "Attempt to compare the file to itself"))
+ (diff file current switches)))
;;;###autoload
(defun dired-backup-diff (&optional switches)