GNU bug report logs -
#5225
dired-diff should be more safe
Previous Next
Reported by: Juri Linkov <juri <at> jurta.org>
Date: Wed, 16 Dec 2009 09:40:06 UTC
Severity: normal
Done: Juri Linkov <juri <at> jurta.org>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 5225 in the body.
You can then email your comments to 5225 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>
:
bug#5225
; Package
emacs
.
(Wed, 16 Dec 2009 09:40:06 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Juri Linkov <juri <at> jurta.org>
:
New bug report received and forwarded. Copy sent to
Emacs Bugs <bug-gnu-emacs <at> gnu.org>
.
(Wed, 16 Dec 2009 09:40:07 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> emacsbugs.donarmstrong.com (full text, mbox):
Currently using `dired-diff' has a high risk of deleting a file.
When two compared file names refer to the same file, or when one of them
is the directory name of the second file (thus the file is compared
against itself), then the user may not notice that `diff' compares the
same file with itself, and when `diff' says there are no differences,
decide to delete the file (thinking that two files have the same content).
The patch below eliminates this risk by signalling an error when
comparing the same file to itself:
=== modified file 'lisp/dired-aux.el'
--- lisp/dired-aux.el 2009-11-25 17:15:19 +0000
+++ lisp/dired-aux.el 2009-12-16 09:16:34 +0000
@@ -60,27 +60,44 @@
(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)
--
Juri Linkov
http://www.jurta.org/emacs/
Reply sent
to
Juri Linkov <juri <at> jurta.org>
:
You have taken responsibility.
(Fri, 18 Dec 2009 07:33:03 GMT)
Full text and
rfc822 format available.
Notification sent
to
Juri Linkov <juri <at> jurta.org>
:
bug acknowledged by developer.
(Fri, 18 Dec 2009 07:33:03 GMT)
Full text and
rfc822 format available.
Message #10 received at 5225-done <at> debbugs.gnu.org (full text, mbox):
Fixed.
--
Juri Linkov
http://www.jurta.org/emacs/
bug archived.
Request was from
Debbugs Internal Request <bug-gnu-emacs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Fri, 15 Jan 2010 12:24:04 GMT)
Full text and
rfc822 format available.
This bug report was last modified 15 years and 153 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.