emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] emacs/lisp ChangeLog dired-aux.el


From: Juri Linkov
Subject: [Emacs-diffs] emacs/lisp ChangeLog dired-aux.el
Date: Thu, 17 Dec 2009 01:16:19 +0000

CVSROOT:        /sources/emacs
Module name:    emacs
Changes by:     Juri Linkov <jurta>     09/12/17 01:16:18

Modified files:
        lisp           : ChangeLog dired-aux.el 

Log message:
        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.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/ChangeLog?cvsroot=emacs&r1=1.16910&r2=1.16911
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/dired-aux.el?cvsroot=emacs&r1=1.200&r2=1.201

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/emacs/emacs/lisp/ChangeLog,v
retrieving revision 1.16910
retrieving revision 1.16911
diff -u -b -r1.16910 -r1.16911
--- ChangeLog   17 Dec 2009 00:21:47 -0000      1.16910
+++ ChangeLog   17 Dec 2009 01:16:15 -0000      1.16911
@@ -1,3 +1,10 @@
+2009-12-17  Juri Linkov  <address@hidden>
+
+       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  <address@hidden>
 
        * emacs-lisp/autoload.el (batch-update-autoloads): Only exclude

Index: dired-aux.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/dired-aux.el,v
retrieving revision 1.200
retrieving revision 1.201
diff -u -b -r1.200 -r1.201
--- dired-aux.el        16 Dec 2009 09:52:47 -0000      1.200
+++ dired-aux.el        17 Dec 2009 01:16:18 -0000      1.201
@@ -90,7 +90,14 @@
                       (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)




reply via email to

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