2

I'm using bash, version 4.3.42(4)-release (i686-pc-cygwin) on cygwin. I want to create a symlink C: -> /cygdrive because a vagrant build process has that file path specified. The vagrant script has already created some filesystem entity called C:

$ ls -lha
total 8.0K
drwxrwxr-x+ 1 user Domain Users 0 Oct 27 15:55 .
drwxrwxr-x+ 1 user Domain Users 0 Oct 27 15:55 ..
drwxrwxr-x+ 1 user Domain Users 0 Oct 27 14:59 C:

But it's not actually linked to the C: drive:

$ ls C:

$

This C: thing works in other shells based on cmd.exe, such as msysgit, but cygwin doesn't understand it.

#<R10K::Task::Module::Sync:0x38c6010> failed while running: Command git --git-dir C:/cygwin/home/user/vagrant/puppet/modules/profile/.git --work-tree C:/cygwin/home/user/vagrant/puppet/modules/profile remote set-url cache C:/cygwin/home/user/.r10k/git/ssh---git@git.highlights.com-7999--vagrant-profile.git exited with 128: fatal: No such remote 'cache'

But the file exists:

$ ls puppet/modules/profile/.git
config  description  HEAD  hooks  index  info  logs  objects  packed-refs  refs

I'm having problems specifying C: as a filename.

$ ln -s /cygdrive/c "C:"
ln: target ‘C:’ is not a directory: No such file or directory
$ ln -s /cygdrive/c C\:
ln: target ‘C:’ is not a directory: No such file or directory
$ ln -s /cygdrive/c "C\:"
ln: failed to create symbolic link ‘C\\:’: No such file or directory
$ cdrive="C:"
$ ln -s /cygdrive/c $cdrive
ln: target ‘C:’ is not a directory: No such file or directory

How can I create this symlink?

Edit Solutions suggested in comments about a lowercase c: don't work in my vagrant script. It seems to need the C: (see the vagrant error I listed aboe, it tries to access the path C:/cygwin/home/user/...

  • 3
    AFAIK, you cannot create files with backslash or : in their name on MS Windows. – Stéphane Chazelas Oct 29 '15 at 15:30
  • Having said that ln -s /cygdrive/c ./c: seems to work (and the symlinks don't show in cmd.exe's dir). – Stéphane Chazelas Oct 29 '15 at 15:33
  • Cygwin seems to understand c: specially already (at least bash's cd c: or ls c:/ seem to) – Stéphane Chazelas Oct 29 '15 at 15:35
  • @StéphaneChazelas the vagrant script already creates a C:, but vagrant can't use it. Check my edits. – user394 Oct 29 '15 at 15:56
  • Well ls c: or ls C: might not work in cygwin, but ls c:/ or ls C:/WINDOWS (windows path are more or less case insensitive) or ls 'c:\windows' work in cygwin. ln -s /cygdrive/c ./c: or ln -s /cygdrive/c ./C: both work and shouldn't make a difference. But note that it just creates that symlink in the current directory. It may help for those cygwin functions that don't accept DOS paths if any, but only if their current directory contain that symlink. – Stéphane Chazelas Oct 29 '15 at 16:25
0
ln -s /cygdrive/c ./C:

Thanks! @StéphaneChazelas

I posted this under my own account so this question would have an answer not buried in the comments. This is after I just discovered my own question while googling it :S

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.