standards/171577: realpath(3) returns ENOTDIR instead of ENOENT

Ed Maste emaste at freebsd.org
Wed Sep 12 17:20:10 UTC 2012


The following reply was made to PR standards/171577; it has been noted by GNATS.

From: Ed Maste <emaste at freebsd.org>
To: Andrey Chernov <ache at freebsd.org>, Ed Maste <emaste at freebsd.org>, 
	FreeBSD-gnats-submit at freebsd.org
Cc:  
Subject: Re: standards/171577: realpath(3) returns ENOTDIR instead of ENOENT
Date: Wed, 12 Sep 2012 13:14:50 -0400

 On 12 September 2012 12:56, Andrey Chernov <ache at freebsd.org> wrote:
 
 > 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.
 
 Hi Andrey, sorry I did not see your comment before I committed the
 change (or I would have held off to discuss first).
 
 I find the wording in the POSIX realpath errors section confusing, but
 believe it is clear from the description of ENOTDIR in section 2.3 and
 the general use of ENOENT and ENOTDIR that ENOENT must be used for
 this case.  This is also the behaviour of Solaris and glibc.
 
 I am going to try to get the realpath text clarified.
 
 -Ed


More information about the freebsd-standards mailing list