On 05/20/2010 02:58 PM, Jon Beniston wrote:
> Hi,
> 
> I'm trying to get the linuxtools Eclipse autoconf plugin to work on Cygwin.
> One problem I'm having is that a configure script (from newlib) is calling
> pwd which is returning a Windows style path (e.g. c:/something), which
> causes it to fail. This appears to be because Eclipse is setting the
> environment variable PWD to a Windows style path. This can be reproduced
> with:
> 
> PWD=c:/cygwin/ sh
> $ pwd
> c:/cygwin/

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.

> 
> I'm just wondering what would be the recommended way to tackle this:
> 
> 1. Change Eclipse so it sets PWD to a Cygwin style path. 

That, or not set it at all in the first place.

> 2. Patch the bash pwd builtin so it doesn't return Windows paths. 

I don't want to go changing bash just for this.

> 3. Change the configure script so it uses /usr/bin/pwd instead of the
> builtin (which returns the Cygwin style path).
> 4. Something else? 

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:

$ (cd /cygdrive/c; PWD=c:/ bash -c pwd)
c:/
$ (cd /cygdrive/c; PWD=c:/ bash -c "cd -P .; pwd")
/cygdrive/c

-- 
Eric Blake   ebl...@redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to