0

In cygwin, in order to remove /cygdrive prefix in the paths, I did a mount like this -

mount -c /

after restarting cygwin, when I say pwd - it gives me something like - /c/Work/shared/imply-1.1.1 [actually per windows c:\Work\shared\imply-1.1.1] and now I have a perl script that I am running using cygwin and I see an error ... something like - Error: Cannot find module 'C:\c\Work\shared\imply-1.1.1\dist\pivot\bin\pivot' that additional /c/ which is a drive notion returned from cygwin is causing above error (at least one way of looking at it).

Any idea on how to get rid of that ?

Update: To give a better context to the above issue. Here is what is happening - There is a script file, whose contents are as follows -

#!/bin/bash -eu

if [ "$#" -gt 1 ]
then
  echo "usage: $0 [conf-dir]" >&2
  exit 1
fi

PWD="$(pwd)"
WHEREAMI="$(dirname "$0")"

if [ "$#" -lt 1 ] || [ "x$1" = "x" ]
then
  CONFDIR="$WHEREAMI"/../conf
else
  CONFDIR="$1"
fi

CONFDIR="$(cd "$CONFDIR" && pwd)/pivot"
WHEREAMI="$(cd "$WHEREAMI" && pwd)"

When I echo the contents of the CONFDIR and WHEREAMI, I get the following -

C:\cygdrive\c\Work\shared\imply-1.1.1\conf\pivot
C:\cygdrive\c\Work\shared\imply-1.1.1\bin\

But the ${pwd} paths were supposed to be resolved as "c:\Work....."

So what I am doing wrong in cygwin?

AJM
  • 1,317
  • 2
  • 15
  • 30
jagamot
  • 5,348
  • 18
  • 59
  • 96
  • The "something like" worries me. Does the error message really include the `C:`? Can you copy and paste it into your question? I'd also expect changing the mount to cause perl to lose its modules -- after all they are now at a different path. What does `perl -E 'say "@INC"'` show? – Borodin Apr 05 '16 at 19:49
  • In light of your update, ***why is this question tagged [perl]?*** – Sinan Ünür Apr 07 '16 at 15:12

2 Answers2

0

Don't mount C:\ as / in Cygwin:

If this is any help for you, I was intent to use something similar to what you want ... I've tried, first on NT4, then on W2k, to setup a *NIX-like single-root filesystem, where C:\ is the only root, and every other device is a [sub]folder somewhere out there.

Guess, what? It didn't work ... You can't reliably use CD/DVD drives, when they are not represented as disk letters, you can't disconnect removable drives without first breaking the mount point ... it's just too much trouble to maintain.

Also, I have been mixing Cygwin, Strawberry, and custom MSVC builds of perl on the same machine for more than a decade now, and I do not understand how the /cygdrive prefix presents a problem.

In Cygwin Bash, the following works as expected:

$ ls D:/Src

In cmd.exe,

C:\Users> c:\opt\cygwin64\bin\perl -E "opendir $h, 'D:/Src'; say for readdir $h"

also works as expected.

See also the CYGWIN environment variable:

(no)dosfilewarning - If set, Cygwin will warn the first time a user uses an "MS-DOS" style path name rather than a POSIX-style path name. Defaults to off.

Sinan Ünür
  • 116,958
  • 15
  • 196
  • 339
0

What about cygpath (Convert Unix and Windows format paths, or output system path information)...

$ pwd
/cygdrive/c/Windows/System32

$ cygpath -w $(pwd)
C:\Windows\System32