Re: Relative and absolute symlinks
Hi,
To summarize, here are a few use cases:
1) A directory that lives in the package is replaced by a symbolic link
to another partition (I've done it in a space crunch, people sharing
directories using AFS run into similar issues.)
2) Remote mounting a directory from one machine on to another with a
different path (I often use sshfs to work on remote machines,
people using NFS also fall into this category
In case 1, relative symlinks pointing outside the heirarchy
break; since the relative path to an external file is different from
the old and the new location.
Example:
/var/lib/foo --> /u/foo
/var/lib/foo/log should point to /var/logs/foo.log
/u/foo/log --> /var/logs/foo.log --- works
/u/foo/log --> ../../logs/foo.log --- fails
In case A, symlinks pointing inside the path hierarchy continue
to work (that is, a symlink with no ../ path component are sure to
work, symlinks pointing up will break is the local relocation is in
that upward path). So, I agree with Russ that symbolic links in the
same tree should be encouraged, since that helps out in case 2, and
does not break case 1.
In case 2, absolute paths in the same directory tree would point
to the work machine, not to the files they point to.
Example:
machineA:/var mounted on /mnt/machineA
/var/lib/foo/log should point to /var/logs/foo.log
/u/foo/log --> ../../logs/foo.log --- Works
/u/foo/log --> /var/logs/foo.log --- fails (points to my
foo.log, not MachneA's)
The original policy was supposed to allow the latter to work as
well, but it all boils down to common case. I often use sshfs, but that
might not be the common case.
Rhonda made the suggestion that we allow absolute links /usr/*
and /var/* symlinks to be absolute between different hierarchies, since
these hierarchies are often the target of relocation-via-symlinking.
A suggestion was made that links in the /usr/share/doc/
hierarchy could remain relative (/usr/share/doc/bash-doc/examples ->
../bash/examples, perhaps for the reason that people are unlikely to
move just one directory out of /usr/share/doc/ via symlinks, and we
might as well not break case 2 for folks.
I think case 1 is more important than case 2, since the latter
is a convenience and useful for remote admin, but case 1 helps out the
local machine, and is often a godsend in critical nearly out of disk
space on important server situation.
Do we have consensus that a:
a) links that do not climb directory trees should be encouraged to be
relative (do not break case 2)
b) subdirectories of /var/*/ and /usr/* should be treated as top level
directories for the purposes of the relative/absolute symlink rule:
any links that climbs out of /usr/foo/bar or /var/foo/bar should be
absolute, and the rest of the current rule stays in place?
manoj
--
"Linux poses a real challenge for those with a taste for late-night
hacking (and/or conversations with God)." (By Matt Welsh)
Manoj Srivastava <srivasta@debian.org> <http://www.debian.org/~srivasta/>
1024D/BF24424C print 4966 F272 D093 B493 410B 924B 21BA DABB BF24 424C
Reply to: