This is the mail archive of the
mailing list for the Cygwin project.
Re: Problem with stat
Eric Blake <email@example.com> writes:
> David Kastrup <dak <at> gnu.org> writes:
>> >> fstat, yes. But shouldn't stat be able to report S_ISLNK on a broken
>> >> link?
>> > No. It must fail with ENOENT.
>> > http://www.opengroup.org/onlinepubs/009695399/functions/stat.html
>> No information there. "component of a path" has nothing to do with
>> symlink resolution.
> "If the named file is a symbolic link, the stat() function shall
> continue pathname resolution using the contents of the symbolic
> link, and shall return information pertaining to the resulting file
> if the file exists."
This says nothing about what is returned if the file does not exist.
> In other words, if file is a broken symlink, symlink resolution MUST
> take place,
Nothing whatsoever in the above states this. Only the behavior when
the resulting file exists is specified.
> at which point, the brokenness of the symlink means that stat() MUST
> fail with ENOENT because a component of the path does not exist.
I don't see where this is apparent from the wording.
> Cygwin is correct here, as is Linux.
They don't conflict, but that is all.
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html