Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 12 Sep 2012 17:20:15 GMT
From:      Eric Blake <eblake@redhat.com>
To:        freebsd-standards@FreeBSD.org
Subject:   Re: standards/171577: realpath(3) returns ENOTDIR instead of ENOENT
Message-ID:  <201209121720.q8CHKFln069120@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR standards/171577; it has been noted by GNATS.

From: Eric Blake <eblake@redhat.com>
To: bug-followup@FreeBSD.org, emaste@FreeBSD.org,
        Andrey Chernov <ache@FreeBSD.org>
Cc:  
Subject: Re: standards/171577: realpath(3) returns ENOTDIR instead of ENOENT
Date: Wed, 12 Sep 2012 11:15:53 -0600

 This is an OpenPGP/MIME signed message (RFC 2440 and 3156)
 --------------enig27BF737EE4D47602967C34CC
 Content-Type: text/plain; charset=UTF-8
 Content-Transfer-Encoding: quoted-printable
 
 >> ENOTDIR is
 >>=20
 >>      20 ENOTDIR Not a directory.  A component of the specified pathnam=
 e
 >>              existed, but it was not a directory, when a directory was=
 
 >>              expected.
 >>=20
 >> >How-To-Repeat:
 >>=20
 >> feynman% realpath /does-not-exist/foo
 >> realpath: /does-not-exist/foo: Not a directory
 >=20
 > It works as designed. See POSIX realpath ERRORS section
 > http://pubs.opengroup.org/onlinepubs/9699919799/functions/realpath.html=
 
 >=20
 > [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.
 
 Andrey, you are arguing that since /does-not-exist is missing, it is not
 a directory; but the POSIX wording for ENOENT vs. ENOTDIR is quite clear:=
 
 
 http://pubs.opengroup.org/onlinepubs/9699919799/functions/V2_chap02.html#=
 tag_15_03
 
 [ENOENT]
     No such file or directory. A component of a specified pathname does
 not exist, or the pathname is an empty string.
 
 [ENOTDIR]
     Not a directory. A component of the specified pathname exists, but
 it is not a directory, when a directory was expected.
 
 In this particular case of /does-not-exist/foo, '/does-not-exist' is a
 path component that does not exist (ENOENT applies), but is NOT a case
 of a component that exists but is not a directory where a directory was
 expected (ENOTDIR does not apply).  Ed's patch looks correct to me.
 
 --=20
 Eric Blake   eblake@redhat.com    +1-919-301-3266
 Libvirt virtualization library http://libvirt.org
 
 
 --------------enig27BF737EE4D47602967C34CC
 Content-Type: application/pgp-signature; name="signature.asc"
 Content-Description: OpenPGP digital signature
 Content-Disposition: attachment; filename="signature.asc"
 
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.12 (GNU/Linux)
 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg
 Comment: Using GnuPG with Mozilla - http://www.enigmail.net/
 
 iQEcBAEBCAAGBQJQUMNKAAoJEKeha0olJ0Nq7F4H/izH/A28gWyNeaeV9l0+ICrJ
 W3LzwsTF6ebf5vckyargt/4Vgf1p0/vGyWfSaQVXHTGJ2k7UD7Kqrd+lwvgATYCh
 T6yfevqC/igAfYPGEmIuvW5WlzxMvp/4CAkohi/b668mwEsNANXOaoloxzE57gHJ
 bGJJPhpULyEjIXCJacYIbW8AWpKU8InBZwbXQvNyEQ25we86DbsAa5cJ5rsKs6NY
 jHCpK8vI4ggkPXyrk0JhN0s4hP48KcC9LiuHQJ3n2lCliQApghozvjBAJqZIt0rp
 KksgkPS4ZAZXLoA7vxj37+dsL9VV+A/XdUmUWjmD9d892FerW8HC1ILzaj8HnnU=
 =0kNd
 -----END PGP SIGNATURE-----
 
 --------------enig27BF737EE4D47602967C34CC--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201209121720.q8CHKFln069120>