bash pwd returning windows style paths

Jon Beniston jon@beniston.com
Thu May 20 23:40:00 GMT 2010


> POSIX states that a shell is under no obligation to trust a PWD
> inherited from the parent process, and that there are unspecified
> results if you try to manually change PWD outside of the use of 'cd'
> within the shell.  Bash, in particular, merely checks whether the
> current value of the inherited PWD happens to match the current
> directory, and not whether it is a canonical spelling.

>> 1. Change Eclipse so it sets PWD to a Cygwin style path. 
>
> That, or not set it at all in the first place.

Looking through some of the Eclipse code this looks tricky. I think Eclipse
(the CDT plugin actually) sets it up as a default environment variable so
that any tool it runs can use it (which includes programs not run via bash
and other non-cygwin based tools). If it were removed, I presume other tools
could break that depend on it. Similarly I guess Windows or Ming based tools
would fail if it was a Cygwin path.

> You can use 'cd -P .' to force bash to set PWD to the canonical name of
> the current directory, which will then get rid of the windows-style
naming:

Thanks - I tried adding this to the newlib configure script and it now
works. 

>> 2. Patch the bash pwd builtin so it doesn't return Windows paths. 
>
> I don't want to go changing bash just for this.

Fair enough, I guess this probably isn't the right place anyway, as it
wouldn't help other Cygwin programs not run via bash.

I notice that Cygwin does convert the path style for some environment
variables, such as PATH, HOME and TMP. Would it make any sense to add PWD to
that list?

Cheers,
Jon




--
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