emacs-pretest-bug
[Top][All Lists]
Advanced

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

Re: dired-do-rename on "." and ".."


From: Luc Teirlinck
Subject: Re: dired-do-rename on "." and ".."
Date: Mon, 9 Jun 2003 15:41:43 -0500 (CDT)

Actually was there ever a bug in all of this?  I do not believe so any
more.  From Markus' original message:

    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/

All of the above makes perfect sense.  The `R' command in dired is
analogous to the shell command mv.  Most shells have tilde expansion,
but I do not know of any shell that has dot expansion.

In other words we are _not_ trying to rename ~/a to ~/b/a, we are
trying to rename ~/a/. to ~/b/. , that is to ~/b which already exists.
It seems that if one remembers that, the entire behavior Markus
describes makes perfect sense.

I did the entire exercise with the four files I described before in
bash, except that I replaced ~/ everywhere with ~/junkdir, just to be
super-safe.

Now we do:

bash --norc  (Same reason that we do emacs -q)
cd junkdir/d/c

then:

[bash2.05b.0 ~/junkdir/d/c 4 3] mv file1 . file2 .. ~/junkdir/b
mv: cannot overwrite directory `/home/teirllm/junkdir/b/.'
mv: cannot overwrite directory `/home/teirllm/junkdir/b/..'

Of course, . and .. stand for . and .., they do _not_ get expanded,
this is _not_ like ~.  file1 and file2 did get moved to ~/junkdir/b

Sincerely,

Luc.





reply via email to

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