[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Test failure on FreeBSD (permissible errno values)

From: Eric Blake
Subject: Re: Test failure on FreeBSD (permissible errno values)
Date: Wed, 12 Sep 2012 09:29:15 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:15.0) Gecko/20120828 Thunderbird/15.0

On 09/12/2012 09:21 AM, Ed Maste wrote:
>> Since '/path/to/zzz' does not exist, this should be ENOENT; ENOTDIR
>> would only be valid in the case where /path/to/zzz exists but is not a
>> directory.  It sounds like a bug in the FreeBSD kernel.
>> That said, are we already replacing realpath() on FreeBSD?  If so, then
>> we should fix our replacement; if not, then I'm probably okay with
>> relaxing the test to allow the alternate error code.
> After a little investigation, I see that the errno comes from
> FreeBSD's realpath.  The behaviour was introduced by the fix for
> http://www.freebsd.org/cgi/query-pr.cgi?pr=128933 ("realpath(3) does
> not follow SUS specification for ENOENT / ENOTDIR conditions"), which
> has a followup with the interpretation that POSIX demands ENOTDIR and
> provides the following example:
>     # realpath /bin/non_existent/cp
>     realpath: /bin/non_existent/cp: No such file or directory
>     (should be: "Not a directory", as early as non_existent checked)
> I don't necessarily agree with this interpretation, but I do think
> there's ambiguity in the POSIX wording.  The gnulib test is equivalent
> to realpath("/path/to/zzz/.."), where it's arguable that a component
> of the path prefix (specifically, the zzz) is not a directory.

In POSIX, the wording "is not a directory" is true only if the file
exists as some other type.  But here, zzz does not even exist; hence,
the ENOENT error takes precedence.  This is a bug in the FreeBSD
realpath() code, because they misinterpreted POSIX.

Eric Blake   address@hidden    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]