[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: Wed, 30 Nov 2005 09:57:53 -0800
User-agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux)

Eric Blake <address@hidden> writes:

> I maintain that Linux is still
> POSIX-compliant by allowing rename("a", "b/") to succeed

It does appear that POSIX does not specify what should happen when you
do this:

mkdir new
cd new
touch a
mv a b/c

That is, if "b" does not exist, then rename("a", "b/c") is not
required to fail.  That's very strange, but there's nothing in the
existing language that requires it to fail.

Hence you are right: rename("a", "b/") is not required to fail either.

I view this as a defect in POSIX.

> rename("a", "b/.") must fail since "b/." has a trailing dot component

I see no difference here.  POSIX allows rename("a", "b/.") to succeed,
using the same logic as above.

> We should probably bring this up on the austin mailing list.

Yes, probably.

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

> I also would favor (B).  But we certainly need testsuite additions to
> ensure that we don't introduce future regressions against this decision.

OK, it'll be harder to test (B), since that relies on the test suite
knowing what rename() does.  But I guess we can work around that.

reply via email to

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