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.
signature.asc
Description: This is a digitally signed message part
-- http://linuxfromscratch.org/mailman/listinfo/lfs-support FAQ: http://www.linuxfromscratch.org/lfs/faq.html Unsubscribe: See the above information page