[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: Thu, 01 Dec 2005 10:52:42 -0800
User-agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux)

Eric Blake <address@hidden> writes:

> According to Paul Eggert on 11/30/2005 10:57 AM:
>> 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.
> I read "ENOTDIR: A component of either path prefix is not a directory" as
> forbidding rename("a", "b/c") when b does not exist.

No, ENOTDIR is for something else: it's for when "b" exists but is
not a directory.  Something like this:

   $ mkdir new
   $ cd new
   $ touch a b
   $ mv a b/c
   mv: accessing `b/c': Not a directory

However, if "b" does not exist, there's nothing in POSIX that says (or
even implies) that rename("a", "b/c") must fail with errno==ENOENT.  I
think this is a bug in the standard -- an inadvertant omission.

>> POSIX allows rename("a", "b/.") to succeed,
>> using the same logic as above.
> No.  The resolution of XSH 108 explicitly requires failure if a trailing
> component is . or .., along with words in EINVAL to that effect.

Hmm, I'm not familiar with that resolution.  I looked for it in
<http://www.opengroup.org/austin/aardvark/finaltext/xshbug.txt> and
found that XSH Enhancement Request Number 108 talks about the y0()
function.  Perhaps you got the number wrong?  Or am I looking in the
wrong place?

In that same file I did find XSH ERN #104, which talks about glob()
and trailing slashes and symlinks, but I don't see how that
interpretation is relevant here.

reply via email to

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