X-Recipient: archive-cygwin@delorie.com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
	:list-unsubscribe:list-subscribe:list-archive:list-post
	:list-help:sender:message-id:date:from:mime-version:to:subject
	:references:in-reply-to:content-type:content-transfer-encoding;
	 q=dns; s=default; b=WRwNbbFWoq+hkYkLfPV7YLjuemII7MdvA4UDfPXWqKT
	qdaNGcbFqMD36p/eIYkBCetAoc6XMbGzQPNuyiZqsv1ZYSzeB8Pc88FkFEfKXTPY
	9//053eplbJSDsVtaZdovu3hhMbjN+F9QwyMc7iKlKdJQeEZY9eldHNsqAs2s3VI
	=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
	:list-unsubscribe:list-subscribe:list-archive:list-post
	:list-help:sender:message-id:date:from:mime-version:to:subject
	:references:in-reply-to:content-type:content-transfer-encoding;
	 s=default; bh=+M2JLO9/IL5kBnecaY33V3NwoDY=; b=bhUrEQVtQUeK3nLsc
	kjsm84263U0njINJPMnWoF+yytK0fyTdbDbHo65OmnJrbp06mfxVjNszf1eTrAKp
	/eZ5YGtg1Qy5PxEY+tK9qBiaaSrEyFaKp4UsQ4OTNob+1UU52wfIlgxNILmboO/3
	IKN6+nqqC0BIpG7BLyZFSzWRxM=
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
X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=AWL,BAYES_00,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,KHOP_THREADED,RCVD_IN_DNSWL_NONE,RCVD_IN_HOSTKARMA_YE,SPF_PASS autolearn=ham version=3.3.2
X-Received: by 10.66.100.200 with SMTP id fa8mr5266559pab.148.1377175718521;        Thu, 22 Aug 2013 05:48:38 -0700 (PDT)
Message-ID: <5216089C.6080502@gmail.com>
Date: Thu, 22 Aug 2013 21:48:28 +0900
From: nu774 <honeycomb77@gmail.com>
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130801 Thunderbird/17.0.8
MIME-Version: 1.0
To: cygwin@cygwin.com
Subject: Re: shell-init: error retrieving current directory
References: <521571A7.6010503@gmail.com> <521575A1.6020304@gmail.com> <52157710.7060509@gmail.com> <20130822111143.GL2562@calimero.vinschen.de>
In-Reply-To: <20130822111143.GL2562@calimero.vinschen.de>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit

Hi,

It seems that getcwd() of bash continues the following approach until it 
reaches /.

1) readdir() on the parent directory.
2) for each dirent returned by readdir(), find the entry that matches 
the current dirctory (by comparing inode or something).
3) set parent dir as current, and continue from 1).

When you call getcwd() not under / (that is, C:/cygwin64), say 
/c/foo/bar (here I assume C drive is mounted on /c), step 2) will fail 
when current is /c, since readdir() on / doesn't return c as a dirent.

In short, getcwd() of bash doesn't work as expected in this situation, 
and if Cygwin's getcwd() implementation complies requirement by bash, 
HAVE_GETCWD should be enabled.
As far as I can see, HAVE_GETCWD enabled bash.exe is working fine here.


(2013/08/22 20:11), Corinna Vinschen wrote:
> On Aug 22 11:27, nu774 wrote:
>> Hi,
>>
>> Thanks, I see.
>> And I noticed bash.exe of cygwin32 is also using it's own getcwd
>> WITHOUT issue.
>
> Still, why does it fail on 64 bit but not on 32 bit?  Cygwin's path
> handling code is identical for both platforms.
>
>
> Corinna
>


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

