bug-coreutils
[Top][All Lists]
Advanced

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

Re: "mv a b/" when b does not exist


From: Jim Meyering
Subject: Re: "mv a b/" when b does not exist
Date: Tue, 29 Nov 2005 17:24:32 +0100

Eric Blake <address@hidden> wrote:
> According to Paul Eggert on 11/28/2005 10:57 AM:
>>>mv a b/
>>>
>>>mv: target `b/' is not a directory: No such file or directory
>>
>> As I understand it, POSIX says that "mv a b/" is equivalent to
>> rename("a", "b/"),
>
> Correct.

Note that the underlying rename would fail on Linux 2.6.x and *BSD
(but it'd succeed on Solaris 9 and 10):

  $ touch a; rm -rf b; perl -e 'rename "a", "b/" or die "$!"'
  Not a directory at -e line 1.
  [Exit 20]

Currently, mv detects this particular `problem' without performing
an actual rename, so it's more consistent than it would be if it
were relying on the actual system call.

If you can convince the kernel folks to change the way rename works,
or POSIX to dissociate mv behavior from that of rename(2), then you
might have a case for changing GNU mv.

So, technically, I think GNU mv is doing what is required of it,
as long as the underlying rename would also fail.




reply via email to

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