shell-init: error retrieving current directory

nu774 honeycomb77@gmail.com
Thu Aug 22 12:48:00 GMT 2013


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



More information about the Cygwin mailing list