[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
dired-do-rename on "." and ".."
From: |
Markus Rost |
Subject: |
dired-do-rename on "." and ".." |
Date: |
Sun, 1 Jun 2003 23:06:17 -0400 (EDT) |
Create directories "~/a" "~/b". Open a dired buffer for "~/a":
===Buffer a=================================================
/home/rost/a:
total used in directory 8 available 194651436
drwxr-xr-x 2 rost regfacul 4096 Jun 1 22:33 .
drwx--x--x 62 rost regfacul 4096 Jun 1 22:33 ..
============================================================
Put cursor on "." and hit key "R" (which runs the command
dired-do-rename). Answer "~/b" to the prompt:
==> Rename . to: ~/b
I would expect that directory "~/a" would then be renamed to "~/b/a",
as it happens when do (dired-do-rename "~/a" -> "~/b) in a dired
buffer of "~/". However, instead you get the query
==> Overwrite `/home/rost/b'? [Type yn!q or C-h]
This makes you suspicious, you quit, and no harm was done. But
suppose you answer "y". Then you get an error message:
==> dired-rename-subdir-2: Expected to find `/home/rost/a/./' in
headerline of /home/rost/a/
In fact, directory "~/b" had been deleted and "~/a" has been renamed
to "~/b". At least if "~/b" was empty. The dired buffer looks now
like this:
===Buffer a=================================================
/home/rost/a:
total used in directory 8 available 194651436
drwx--x--x 62 rost regfacul 4096 Jun 1 22:33 ..
============================================================
Typing "g" yields an error:
==> apply: Setting current directory: no such file or directory, ~/a/
If "~/b" is not empty, you get an error:
Move `/home/rost/a/.' to `/home/rost/b' failed:
(file-already-exists File exists /home/rost/a /home/rost/b)
and no harm was done.
I think one should fix this. The minimum would be to disallow
renaming of ".". Better perhaps, allow renaming "." to some other
directory, like renaming a subdirectory, and then update the dired
buffer with the new path.
OK, here it comes worse: Try to rename "..": Create directory
"~/a/c", open the dired buffer for it, put cursor on "..", hit "R",
and answer "~/b". You are prompted with
Overwrite `/home/rost'? [Type yn!q or C-h]
Panic... Fortunately no harm will done if you answer "y". Still, one
should fix this and perhaps disallow renaming of "..".
- dired-do-rename on "." and "..",
Markus Rost <=
- Re: dired-do-rename on "." and "..", Richard Stallman, 2003/06/03
- Re: dired-do-rename on "." and "..", Markus Rost, 2003/06/03
- Re: dired-do-rename on "." and "..", Richard Stallman, 2003/06/04
- Re: dired-do-rename on "." and "..", Markus Rost, 2003/06/04
- Re: dired-do-rename on "." and "..", Luc Teirlinck, 2003/06/05
- Re: dired-do-rename on "." and "..", Richard Stallman, 2003/06/07
- Re: dired-do-rename on "." and "..", Luc Teirlinck, 2003/06/07
- Re: dired-do-rename on "." and "..", Luc Teirlinck, 2003/06/07
- Re: dired-do-rename on "." and "..", Luc Teirlinck, 2003/06/07
- Re: dired-do-rename on "." and "..", Markus Rost, 2003/06/07