Confusion

Re-read the bit about search path for sources. That's the bit that's not in the man. The syntax is also different between hard and soft links, but we won't go into that (yet!).

A good way to test is: (copy each block into a terminal window)

Basic:

mkdir -p alpha/beta/gamma/delta/epsilon/alpha/beta
echo pwd_version > alpha/beta/afile
ln -s alpha/beta/afile alpha/beta/gamma/delta/epsilon/link
ls -l alpha/beta/gamma/delta/epsilon/

(Note: A link was made to the file specified using the _current_ working directory as the base for the relative address even though this behaviour is other than that used in the LFS book.)

(Now to show order of precedence we'll make a second file for ln to choose from:)

rm -r alpha

mkdir -p alpha/beta/gamma/delta/epsilon/alpha/beta
# that's just as before.  Now the two to choose from:
echo pwd_version > alpha/beta/afile
echo other_version > alpha/beta/gamma/delta/epsilon/alpha/beta/afile
ln -s alpha/beta/afile alpha/beta/gamma/delta/epsilon/link
# did it use ...epsilon/ or ./ as the base for the relative # alpha/beta/afile? This will tell:
cat alpha/beta/gamma/delta/epsilon/link

Once again:

rm -r alpha

mkdir -p alpha/beta/
# that's just as before.  Now the two to choose from:
echo pwd_version > afile
echo other_version > alpha/beta/afile
ln -s afile alpha/beta/link
# did it use ...epsilon/ or ./ as the base for the relative
# alpha/beta/afile?  This will tell:
cat alpha/beta/link


Finally, re-run the above using hard links instead of symbolic and the behaviour is different. This time $PWD seems to be the only thing that matters:

mkdir -p alpha/beta/gamma/delta/epsilon/alpha/beta
# that's just as before.  Now the two to choose from:
echo pwd_version > alpha/beta/afile
echo other_version > alpha/beta/gamma/delta/epsilon/alpha/beta/afile
ln alpha/beta/afile alpha/beta/gamma/delta/epsilon/link
# did it use ...epsilon/ or ./ as the base for the relative
# alpha/beta/afile?  This will tell:
cat alpha/beta/gamma/delta/epsilon/link


rm -r alpha

mkdir -p alpha/beta/
# that's just as before.  Now the two to choose from:
echo pwd_version > afile
echo other_version > alpha/beta/afile
ln afile alpha/beta/link
# did it use ...epsilon/ or ./ as the base for the relative
# alpha/beta/afile?  This will tell:
cat alpha/beta/link

Not all that straightforward, eh?
--
http://linuxfromscratch.org/mailman/listinfo/lfs-support
FAQ: http://www.linuxfromscratch.org/lfs/faq.html
Unsubscribe: See the above information page

Reply via email to