Lucas Nussbaum <[EMAIL PROTECTED]> wrote:
> Hi Jim,
>
> The info documentation of mv is inconsistent with its behaviour, as
> described in http://bugs.debian.org/343652 :
> *** [EMAIL PROTECTED]:~/t$ mkdir foo ; touch foo/a
> *** [EMAIL PROTECTED]:~/t$ ln -s foo bar
> *** [EMAIL PROTECTED]:~/t$ mv bar/ zork
> mv: cannot move `bar/' to `zork': Not a directory
>
> While the mv info page says:
>
>    _Warning_: If you try to move a symlink that points to a directory,
>    and you specify the symlink with a trailing slash, then `mv' doesn't
>    move the symlink but instead moves the directory referenced by the
>    symlink.
>
> Is it a documentation bug, or an mv bug?

Hi Lucas,

It is a documentation bug.
What happens when you (ab)use mv like that depends on corner-case
semantics of the underlying rename syscall.  Some systems do precisely
what is described.  If you search the archives (deb or bug-coreutils),
you should be able to find actual the examples I gave when I wrote
that patch.  Here's one more:

  [i386-unknown-freebsd6.1]
  freebsd6$ mkdir foo; touch foo/a; ln -s foo bar; mv bar/ zork
  freebsd6$ find
  .
  ./bar
  ./zork
  ./zork/a

Most people find this very surprising.
Solaris 10 exhibits the same behavior, using either
GNU mv or /bin/mv.

I'll adjust the documentation to say something like this:

  _Warning_: If you try to move a symlink that points to a directory,
  and you specify the symlink with a trailing slash, then `mv's behavior
  is not well specified (it depends on the underlying rename system call).
  It may fail (modern Linux), or it may silently rename not the symlink
  but rather the directory referenced by the symlink (FreeBSD 6.1 and
  Solaris 10).



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to