2

command line shell

echo %PIG_HOME%
C:\cygwin\usr\lib\pig

cygwin

echo $PIG_HOME
C:\cygwin\usr\lib\pig

echo $( cygpath -u "$PIG_HOME" )
/usr/lib/pig

cd $( cygpath -u "$PIG_HOME" )
-bash: cd: /usr/lib/pig: No such file or directory

Question: why is cygpath not converting it to /cygdrive/c/cygwin/usr/lib/pig?

UPDATE:

The path to the pig folder is correct.

command line shell

C:\Users\john.doe> cd %PIG_HOME%
C:\cygwin\usr\lib\pig>

cygwin

john.doe@COMPUTER ~
$ cd /cygdrive/c/cygwin/usr/lib/pig/

john.doe@COMPUTER /cygdrive/c/cygwin/usr/lib/pig
$
ATN
  • 665
  • 8
  • 26

3 Answers3

2

With Cygwin,

C:\cygwin\lib\pig = /usr/lib/pig

and

C:\cygwin\usr\lib\pig = /cygdrive/c/cygwin/usr/lib/pig

This setup is by design.

The C:\cygwin\usr\lib folder is not created by any packages and should not be created by you either.

HYBRID BEING
  • 264
  • 2
  • 11
Zombo
  • 1
  • 62
  • 391
  • 407
0

Type mount in your terminal window.

My c:\cygwin\bin and c:\cygwin\lib\ are mounted at /usr/bin and /usr/lib respectively. I suspect that your c:\cygwin\usr\lib is mounted at /usr/lib.

Therefore, the "unix" path to c:\cygwin\usr\lib\pig would be /usr/lib/pig.

stringsn88keys
  • 940
  • 1
  • 7
  • 22
  • Indeed, it is the case. So how am I supposed to work with Windows paths using cygpath if cygwin cannot understand the path that cygpath outputs? Is it not the purpose of cygpath to make Windows paths readable for cygwin? – ATN Apr 14 '13 at 02:26
  • In my case, the /usr/lib/pig will actually find the file in cygwin. Does it not in your case? – stringsn88keys Apr 15 '13 at 11:27
  • 1
    As Steven Penny mentionned, `C:\cygwin\usr\lib` should not be created because of the ambiguous structure of the mount: `/usr/lib\pig` would then point to both `C:\cygwin\usr\lib\pig` and `C:\cygwin\lib\pig`, a configuration that cannot be working, for obvious reasons (at least once one understood how the cygdrive is mounted). Thus `/usr/lib/pig` did not work for me as I had only the folder `C:\cygwin\usr\lib\pig` and not the folder `C:\cygwin\lib\pig` created. – ATN Apr 15 '13 at 11:34
0

Did you try option "-m, --mixed : like --windows, but with regular slashes (C:/WINNT)"

$ cd /cygdrive/c/cygwin64/home
$  cygpath -m $(pwd)
C:/cygwin64/home