Subject: bug#23017: 25.0.92; Dired: prevent to kill top level directory

From: Tino Calancha <[email-masked]>
Date: Tue, 15 Mar 2016 13:04:49 +0900 (JST)

Good (or morning afternoon evening night)

;; Following code kills the top level directory:
emacs -Q ~
M-x dired-kill-subdir

In GNU Emacs 25.0.92.1 (x86_64-pc-linux-gnu, GTK+ Version 2.24.29)
  of 2016-03-15 built on calancha-pc
Repository revision: dbfbedd3d0f3afcfb811eae0e1a7b1c33fb27735

diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el
index d29abf3..ac0b1a3 100644
--- a/lisp/dired-aux.el
+++ b/lisp/dired-aux.el
@@ -2486,7 +2486,7 @@ dired-kill-subdir
 	 (cur-dir (dired-current-directory))
 	 (cons (assoc-string cur-dir dired-switches-alist))
 	 buffer-read-only)
-    (if (equal cur-dir default-directory)
+    (if (equal cur-dir (expand-file-name default-directory))
 	(error "Attempt to kill top level directory"))
     (prog1
 	(if remember-marks (dired-remember-marks beg end))