Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 12 Sep 2012 13:07:44 -0400
From:      Eitan Adler <lists@eitanadler.com>
To:        Andrey Chernov <ache@freebsd.org>
Cc:        FreeBSD Standards <freebsd-standards@freebsd.org>, bug-followup@freebsd.org
Subject:   Re: standards/171577: realpath(3) returns ENOTDIR instead of ENOENT
Message-ID:  <CAF6rxgkL%2BhSfuRcowHgjqtykUJ39ek2by2Z8-5-3K2ahDqyzzw@mail.gmail.com>
In-Reply-To: <201209121700.q8CH0DFn038845@freefall.freebsd.org>
References:  <201209121700.q8CH0DFn038845@freefall.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On 12 September 2012 13:00, Andrey Chernov <ache@freebsd.org> wrote:
> The following reply was made to PR standards/171577; it has been noted by GNATS.
>
> From: Andrey Chernov <ache@FreeBSD.ORG>
> To: Ed Maste <emaste@FreeBSD.ORG>
> Cc: FreeBSD-gnats-submit@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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAF6rxgkL%2BhSfuRcowHgjqtykUJ39ek2by2Z8-5-3K2ahDqyzzw>