Jim Meyering <[EMAIL PROTECTED]> wrote:
> 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).
FYI, I used different wording:
2008-01-26 Jim Meyering <[EMAIL PROTECTED]>
Improve a warning about non-portable "mv" usage.
* doc/coreutils.texi (mv invocation): Adjust the warning: moving a
dir-symlink-specified-with-a-trailing-slash works in a surprising
manner only on some systems. Reported by Tomas Pospisek in
http://bugs.debian.org/343652.
diff --git a/doc/coreutils.texi b/doc/coreutils.texi
index 3785eae..fc94379 100644
--- a/doc/coreutils.texi
+++ b/doc/coreutils.texi
@@ -7773,10 +7773,14 @@ is a terminal, and the @option{-f} or @option{--force}
option is not given,
own the file, or have write permission on its directory.) If the
response is not affirmative, the file is skipped.
[EMAIL PROTECTED]: If you try to move a symlink that points to a directory,
-and you specify the symlink with a trailing slash, then @command{mv}
-doesn't move the symlink but instead moves the directory referenced
-by the symlink. @xref{Trailing slashes}.
[EMAIL PROTECTED]: Avoid specifying a source name with a trailing slash,
+when it might be a symlink to a directory.
+Otherwise, @command{mv} may do something very surprising, since
+its behavior depends on the underlying rename system call.
+On modern Linux systems, it fails with @code{errno=ENOTDIR}.
+However, on other systems (at least FreeBSD 6.1 and Solaris 10) it silently
+renames not the symlink but rather the directory referenced by the symlink.
[EMAIL PROTECTED] slashes}.
The program accepts the following options. Also see @ref{Common options}.
--
1.5.4.rc4.26.g228a
--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]