Problem with stat

David Kastrup dak@gnu.org
Tue Jun 26 15:51:00 GMT 2007


Eric Blake <ebb9@byu.net> 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.

-- 
David Kastrup


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/



More information about the Cygwin mailing list