[lfs-support] ln -sv ../usr/bin/cpp /lib

Alexander Kapshuk alexander.kapshuk at gmail.com
Thu Mar 22 04:47:15 PDT 2012


On Thu, Mar 22, 2012 at 8:51 AM, Simon Geard <delgarde at ihug.co.nz> wrote:

> On Wed, 2012-03-21 at 21:54 +0200, Alexander Kapshuk wrote:
> > (6). While still in $LFS/sources/gcc-build, I ran ln -sv ../usr/bin/cpp
> > /lib; And this is where I found it confusing, ../usr/bin/cpp ==
> > $LFS/sources/usr/bin/cpp; but /usr/bin/cpp isn't found in $LFS/sources.
> > It's found is $LFS/usr/bin/cpp; I thought that ln was supposed to create
> > a link to an existing file whether using an absolute or a relative path;
>
> Basically, "ln -s" creates a special kind of file (termed a symbolic
> link, soft link, or just symlink) containing the string you passed in to
> it - you can actually see it in the file size of the symlink (it should
> be 14 bytes, for "../usr/bin/cpp").
>
> That string is only interpreted when someone actually tries to read the
> symlink, at which point a relative path is interpreted as relative to
> the directory containing the symlink. It has nothing to do with the
> directory you happened to be in at the time the symlink was created. And
> it's entirely possible for that symlink to point to a file or directory
> that doesn't exist - e.g if the target file is removed, or if it never
> existed in the first place.
>
> Also, note that I refer to symlinks only here. Running "ln" without the
> "-s" results in a different type of link, usually called a hard link.
> And none of what I've said applies to hard links - they're completely
> different from symlinks in almost every way.
>
> Simon.
>
> --
> http://linuxfromscratch.org/mailman/listinfo/lfs-support
> FAQ: http://www.linuxfromscratch.org/lfs/faq.html
> Unsubscribe: See the above information page
>
>
It's all clear as day now.
Thanks for the explanation.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linuxfromscratch.org/pipermail/lfs-support/attachments/20120322/aa1dfaaa/attachment.html>


More information about the lfs-support mailing list