bug-coreutils
[Top][All Lists]
Advanced

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

Re: mv trailing slash warning


From: Jim Meyering
Subject: Re: mv trailing slash warning
Date: Wed, 28 Sep 2005 15:40:23 +0200

Eric Blake <address@hidden> wrote:
> According to Dr. David Alan Gilbert on 9/26/2005 11:17 AM:
>>
>>>>$ mkdir a b
>>>>$ ln -s $PWD/a sym
>>>>$ mv sym/ b
>>>>mv: cannot move `sym/' to `b/sym': Not a directory
>>
>> Nod.  Perhaps the warning needs a warning that it can't be relied
>> on?
>
> No, POSIX requires rename("sym/", name) to move the directory, not the
> symlink, so the warning is accurate and should apply to all systems,
> whether or not their rename is conformant.  You may also want to check
> what `type mv` prints, in case you have an alias in place that strips
> trailing slashes.

As you can imagine, I find the POSIX-required behavior to be senseless.
The above behavior of non-POSIX rename, seen on Linux-2.6.x, is fine.
Now that Linux/glibc provides a sane rename function, I'm tempted
to make mv work in the above manner on all systems rather than allowing
the crazy move-pointed-to-directory behavior on systems with a
technically-conforming rename.

The wrapper will incur the expense of a syscall or two on losing systems
when the first argument ends with `/'.




reply via email to

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