shell-init: error retrieving current directory

Corinna Vinschen corinna-cygwin@cygwin.com
Fri Aug 16 13:47:00 GMT 2013


On Aug 16 12:00, Andy Koppe wrote:
> This might be the same issue as a couple of previous unresolved
> reports with the same error message, but I'm not sure, so here's a new
> thread.
> 
> Steps to reproduce:
> - On Windows 7, install 64-bit Cygwin into C:\cygwin, and let it
> create a desktop shortcut.
> - Edit /etc/fstab to change the cygdrive prefix to /.
> - Double click 'Cygwin64 Terminal' desktop shortcut.
> 
> Result: a bunch of errors before the bash prompt.
> 
> shell-init: error retrieving current directory: getcwd: cannot access
> parent directories: Bad file descriptor
> job-working-directory: error retrieving current directory: getcwd:
> cannot access parent directories: No such file or directory
> job-working-directory: error retrieving current directory: getcwd:
> cannot access parent directories: No such file or directory
> job-working-directory: error retrieving current directory: getcwd:
> cannot access parent directories: No such file or directory
> chdir: error retrieving current directory: getcwd: cannot access
> parent directories: No error
> 
> The errors remain if the shortcut target is changed from invoking
> mintty to invoking bash directly: 'C:\cygwin\bin\bash.exe -l'.
> 
> The errors go away if 'C:\cygwin\bin' is put into the shortcut's
> otherwise empty 'Start In' field. (But they stay if 'C:\' is put there
> instead.)
> 
> They also go away if the cygdrive prefix is changed to anything but
> the root directory.
> 
> I couldn't reproduce the issue with a 32-bit install.

I tried to find the cause for this issue, but as far as I can tell, it's
not a problem in Cygwin.  For some reason bash seems to implement its
own getcwd function, which plays a lot with calling stat on ., ..,
../.., etc.  All results from stat seem to make sense.  The error code
itself (Bad file descriptor, etc) doesn't matter.  It's just some
arbitrary value errno is set to at the time bash decides it doesn't like
what the system calls return.  By tweaking the internal function which
implements the core of the system getcwd function, I could return any
error value at will.

Eric, can you please have a look into this issue?  Something's weird
with bash's getcwd implementation which is apparently only triggered
in the 64 bit version.


Thanks,
Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin/attachments/20130816/996db86f/attachment.sig>


More information about the Cygwin mailing list