standards/171577: realpath(3) returns ENOTDIR instead of ENOENT
Eitan Adler
lists at eitanadler.com
Wed Sep 12 17:08:17 UTC 2012
On 12 September 2012 13:00, Andrey Chernov <ache at freebsd.org> wrote:
> The following reply was made to PR standards/171577; it has been noted by GNATS.
>
> From: Andrey Chernov <ache at FreeBSD.ORG>
> To: Ed Maste <emaste at FreeBSD.ORG>
> Cc: FreeBSD-gnats-submit at FreeBSD.ORG
> Subject: Re: standards/171577: realpath(3) returns ENOTDIR instead of ENOENT
> Date: Wed, 12 Sep 2012 20:56:07 +0400
>
> On Wed, Sep 12, 2012 at 03:54:43PM +0000, Ed Maste wrote:
> > When passed a path with a component that does not exist realpath() sets
> > errno to ENOTDIR instead of ENOENT. See kern/128933 for the change that
> > introduced this behaviour. I believe it is incorrect.
> >
> > ENOTDIR is
> >
> > 20 ENOTDIR Not a directory. A component of the specified pathname
> > existed, but it was not a directory, when a directory was
> > expected.
> >
> > >How-To-Repeat:
> >
> > feynman% realpath /does-not-exist/foo
> > realpath: /does-not-exist/foo: Not a directory
>
> It works as designed. See POSIX realpath ERRORS section
> http://pubs.opengroup.org/onlinepubs/9699919799/functions/realpath.html
ENOTDIR implies the path exists:
[ENOTDIR]
Not a directory. A component of the specified pathname exists, but it
is not a directory, when a directory was expected.
from section 2.3: Error Numbers
http://pubs.opengroup.org/onlinepubs/009695399/functions/xsh_chap02_03.html
--
Eitan Adler
More information about the freebsd-standards
mailing list