This is the mail archive of the cygwin mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Problem with stat

Eric Blake <> writes:

> David Kastrup <dak <at>> writes:
>> >> fstat, yes.  But shouldn't stat be able to report S_ISLNK on a broken
>> >> link?
>> >
>> > No.  It must fail with ENOENT.
>> >
>> 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:
Problem reports:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]