X-Spam-Check-By: sourceware.org
To: cygwin@cygwin.com
From: David Kastrup <dak@gnu.org>
Subject:  Re: Problem with stat
Date:  Tue, 26 Jun 2007 17:34:21 +0200
Lines: 38
Message-ID:  <86ps3irapu.fsf@lola.quinscape.zz>
References:  <46808EA8.2030202@pacific.net.sg> <4680DD73.8090300@sh.cvut.cz> <4680E3A0.3020508@pacific.net.sg> <4680FE40.7010102@byu.net> <46810D24.9000303@pacific.net.sg> <46810FAA.5050508@byu.net> <86zm2mdfox.fsf@lola.quinscape.zz> <468112F2.10802@byu.net> <86vedade9q.fsf@lola.quinscape.zz> <loom.20070626T160440-648@post.gmane.org>
Mime-Version:  1.0
Content-Type:  text/plain; charset=us-ascii
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/23.0.51 (gnu/linux)
X-IsSubscribed: yes
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com

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/

