ls -s and relative pathnames

utzoo!decvax!decwrl!sun!megatest!fortune!hpda!hplabs!hao!seismo!harpo!utah-cs!lepreau utzoo!decvax!decwrl!sun!megatest!fortune!hpda!hplabs!hao!seismo!harpo!utah-cs!lepreau
Tue May 10 22:24:04 AEST 1983


I believe that's a feature, not a bug.  It allows symlinks between files
in the same dir tree to avoid long, unnecessary pathname lookups.  E.g.,
% ls -l /usr/bin/foo
    /usr/bin/foo -> bar
resolves to /usr/bin/bar but avoids accessing the /usr and /usr/bin
directories all over again in namei.

It does tend to be a gotcha, agreed.  There is certainly a way for ln
to get the current dir abspath: getwd(3) == pwd.  That could be added as
a flag to ln I suppose.  But I've gotten used to doing
"ln -s $cwd/bar foo"  (or `pwd`/bar, which is safer)  if I need the full path,
which is most of the time, admittedly.

-Jay
lepreau at utah-cs, harpo!utah-cs!lepreau



More information about the Comp.bugs.4bsd.ucb-fixes mailing list