[Top][All Lists]

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

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

From: Paul Eggert
Subject: Re: "mv a b/" when b does not exist
Date: Mon, 28 Nov 2005 09:57:49 -0800
User-agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux)

Tim Waugh <address@hidden> writes:

> rm -rf a b
> mkdir a
> mv a b/
> fails on Linux with coreutils-5.93:
> mv: target `b/' is not a directory: No such file or directory
> In previous releases (such as 5.2.1) it has worked.  The rename() call
> is also happy with the trailing slash.
> Is this a regression, or an intentional change?

As I understand it, POSIX says that "mv a b/" is equivalent to
rename("a", "b/"), and that the latter should fail when the directory
"b" does not exist.  So the old mv behavior did not conform to POSIX,
and the new mv behavior does.

Admittedly it is a murky area.  One could argue that if Linux
rename("a", "b/") works (contrary to POSIX), then mv should defer to
rename and contradict POSIX as well.  For what it's worth, Solaris 10
mv and OpenBSD 3.4 mv behave the old way, so there is a
sideways-compatibility argument here as well.

(I could possibly be responsible for the change; I don't recall
offhand right now....)

reply via email to

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