[Top][All Lists]

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

Re: strange behaviour with mv (fwd)

From: Jim Meyering
Subject: Re: strange behaviour with mv (fwd)
Date: Wed, 18 Sep 2002 15:00:30 +0200
User-agent: Gnus/5.090008 (Oort Gnus v0.08) Emacs/21.3.50 (i686-pc-linux-gnu)

Michael McGuffin <address@hidden> wrote:
> I may have found a bug with mv.  When x is a symlink to
> a directory, the behaviour of
>    mv x y
> and
>    mv x/ y
> is not the same.  Please read the below description
> I wrote, and the response I got from Derrick Moser.

Thanks for the report, but that is the documented (and required, as I
understand the POSIX standard) behavior.  From the documentation
(e.g., run `info mv'):

     _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.  *Note Trailing slashes::.

And here's the above-referenced section on Trailing slashes:

  Trailing slashes

     Some GNU programs (at least `cp' and `mv') allow you to remove any
  trailing slashes from each SOURCE argument before operating on it.  The
  `--strip-trailing-slashes' option enables this behavior.

     This is useful when a SOURCE argument may have a trailing slash and
  specify a symbolic link to a directory.  This scenario is in fact rather
  common because some shells can automatically append a trailing slash
  when performing file name completion on such symbolic links.  Without
  this option, `mv', for example, (via the system's rename function) must
  interpret a trailing slash as a request to dereference the symbolic link
  and so must rename the indirectly referenced _directory_ and not the
  symbolic link.  Although it may seem surprising that such behavior be
  the default, it is required by POSIX and is consistent with other parts
  of that standard.

reply via email to

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