standards/171577: realpath(3) returns ENOTDIR instead of ENOENT
Andrey Chernov
ache at FreeBSD.ORG
Wed Sep 12 17:00:14 UTC 2012
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
[ENOENT]
A component of file_name does not name an existing file or file_name
points to an empty string.
[ENOTDIR]
A component of the path prefix is not a directory, or the file_name
argument contains at least one non- <slash> character and ends with one or
more trailing <slash> characters and the last pathname component names an
existing file that is neither a directory nor a symbolic link to a
directory.
--
http://ache.vniz.net/
More information about the freebsd-standards
mailing list