[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: Tue, 29 Nov 2005 22:16:00 -0800
User-agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux)

Eric Blake <address@hidden> writes:

> I read that as rename() sees that "a" is a directory, so it resolves
> "b/" as "b/." to ensure that b/ is not the pathname of a
> non-directory (it isn't, since "b/." does not exist), then can go
> ahead

No, because POSIX requires that "Write access permission is required
for the directory containing 'old' and the directory containing
'new'."  Here 'new' is "b/", which is equivalent to "b/.".  So the
directory containing 'new' is "b".  But "b" does not exist, so
'rename' can't have write access to it.

As far as changing 'mv' goes, I see two competing goals here:

A.  Have 'mv' conform to POSIX even if 'rename' does not.

B.  Have 'mv' do whatever 'rename' does, even if 'rename' does not
    conform to POSIX.

We should pick either (A) or (B).  We can't do both at the same time.
We shouldn't do (A) for non-directories and (B) for directories (which
seems to be what's being proposed here).

I'd be happy to help with either (A) or (B).  Personally I have a mild
preference for (B) since it's easier to implement (and it lets us
blame the kernel guys if some POSIX pedant bugs us :-).

reply via email to

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