delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2007/03/12/13:48:44

X-Spam-Check-By: sourceware.org
Message-ID: <45F5A072.4D263AA0@dessent.net>
Date: Mon, 12 Mar 2007 11:48:18 -0700
From: Brian Dessent <brian AT dessent DOT net>
X-Mailer: Mozilla 4.79 [en] (Windows NT 5.0; U)
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: when to use a ln or a mount
References: <Xns98F17521F7E4Bzzappergmailcom AT 80 DOT 91 DOT 229 DOT 5>
X-IsSubscribed: yes
Reply-To: cygwin AT cygwin DOT com
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

zzapper wrote:

> In my confused mind ln and mount seem to achieve the same thing.
> In my case I want to have an easy to type path(s) to my old pc
> 
> so I typed:-
> 
> mount -f -u -b "//dell25/c/" "/o"
> 
> but I also tested
> 
> ln -s //dell25/c/ /old
> 
> In the Cygwin context does one method have any advatanges over the over?

The main difference as far as I see it is that a mount will canonicalize
whereas a link won't.

For example, suppose you wanted to abbreviate c:/Program Files/ as
/pgf.   With either method you can obviously access items in that tree
as just /pgf/foo.  But with a mount, all paths will be normalized to
that prefix, i.e. $(cygpath 'C:\Program Files\Adobe') will return
/pgf/Adobe, because the mount parsing code always chooses the shortest
match.

With a link, it will only be used if explicitly specified (since the
Cygwin path handling code cannot have any knowledge of what symlinks
might exist on disk) so the above cygpath will return
"/cygdrive/c/Program Files/Adobe", and thus you will still get /cygdrive
paths cropping up all over the place if you regularly use that directory
in builds or commands or whatnot.

However, mounts do not show up in readdir, which means they are not
considered e.g. when doing tab-completion at the shell, which can be a
potentially annoying drawback.  However, you can get around that by
creating an underlying directory which shadows the mount.  In the case
of the example above that means creating an empty dir c:/cygwin/pgf
(assuming that c:/cygwin/ is /).  You might want to do this with cmd.exe
and not inside cygwin, to avoid confusion.  This directory should remain
empty, because its contents will never show up in Cygwin.  But its
presence just provides an actual directory entry for readdir to return,
which means tab completion will work as expected.

Brian

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019