On 08/31/2015 10:25 PM, William Harrington wrote:
On Mon, August 31, 2015 18:47, Simon Kitching wrote:
Hi All,

Some examples in the LFS book create symbolic links as follows:

    ln -sfv ../../lib/$(readlink /usr/lib/libz.so) /usr/lib/libz.so

while some create them like this:

    ln -sv /proc/self/mounts /etc/mtab
    ln -sv /tools/lib/libgcc_s.so{,.1} /usr/lib

As far as I can see, all links under /usr/lib which point back to stuff
under /lib use relative paths, while links pointing to config-files and
temporary hacks use absolute.

Is there any reason why relative is preferred over absolute in some
cases? I do find the absolute paths easier to understand..

It really depends on what you want to do.

The classic case for relative links is for a project directory tree so
that when the project is backed-up, moved, or duplicated to another place
in which case absolute links would be confusing and dangerous.

Absolute links are good for something such as systemwide tools where
multiple versions are installed, such as different versions of the GNU
Compiler Collection.

In a nutshell, if the files are in the same relative positions and may be
moved around, relative links are good. If the file is in a known location,
such as a config file, then absolute links would be good.

Sorry, should have been more explicit. I was wondering about the use of rel vs abs symlinks *in this particular LFS context* (/usr/lib->/lib). I couldn't see any reason why "/usr/lib" would get moved, so saw no difference between relative ("/usr/lib/../../lib/foo") and absolute ("/lib/foo") usage in this case except that absolute is slightly more readable.

Initially, the LFS root is mounted in the host system as "/mnt/lfs", so the relative links would point to the right files there, while absolute links would not. But I can't see that making any difference, as presumably nobody _expects_ those links to be usable in that circumstance.

I certainly agree with you (and Bruce) that relative links have their purposes - just wasn't sure if there was something special reason to use relative here (eg to do with chroots or something). Looks like it is just a stylistic choice, which is fine. And as Bruce noted in another email, demonstrating both relative and absolute symlinks is good for the reader.

Thanks, Simon


--
http://lists.linuxfromscratch.org/listinfo/lfs-support
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page

Do not top post on this list.

A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?

http://en.wikipedia.org/wiki/Posting_style

Reply via email to