This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: when to use a ln or a mount


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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]