[uw.mfcf.people] selective use of absolute on $path

idallen@watcgl.waterloo.edu (08/25/89)

From: "Ian! D. Allen [CGL]" <idallen>

    % set path=( "`absolute $path:q`" )

The above works nicely provided you don't have "." in your path.
(Provided you don't have *any* relative paths in your path, that is.)
I've added it to the CGL standard login scripts.  It shortens most
command look-ups considerably.  Using the distributed searchpath/showpath
file is awful:

    cgl% showpath standard
    /software/.admin/bins/bin:/usr/ucb:/bin:/usr/bin

    cgl% absolute -v /software/.admin/bins/bin/lc
    /software/.admin/bins/bin/lc
     ^^^^^^^^
     vvvvvvvvvvv
    /p3/software/.admin/bins/bin/lc
			^^^^
    vvvvvvvvvvvvvvvvvvvvvvvvvvvv
    /.software/local/.admin/bins/bin/lc
	       ^^^^^
    vvvvvvvvvvvvvvvvv
    /usr/var/software/.admin/bins/bin/lc
				      ^^
    vvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
    /usr/archware/mfcf-misc/bin/lc
    /usr/archware/mfcf-misc/bin/lc

Applying absolute to the $path reduces this to just the last symlink.  In
fact, shouldn't the showpath data files have /.software/local/.admin/bins/bin
(the local file name) in them instead of the /software rooted path?
That would get rid of two symlink look-ups even without using absolute.

It would be nice if showpath had an option to apply the absolute()
function to absolute pathnames, delete duplicates, and leave the relative
paths alone.  I'd use it on main machines that weren't dependent on /NFS/.
As it is, parsing $path and weeding out relative paths so that I can
use absolute on the absolute paths is very slow.

Here's an alias I find very useful in tracing paths to commands:

    alias atr 'absolute -v `showpath findall=!^ sep=" "`'

as in 

    cgl% atr searchpath
    /usr/var/software/.admin/bins/bin/searchpath
				      ^^^^^^^^^^
    vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
    /usr/archware/mfcf-basics/bin/searchpath
    /usr/archware/mfcf-basics/bin/searchpath
    /bin/searchpath
	 ^^^^^^^^^^
	 vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
    /bin/../../../../software/mfcf-basics/bin/searchpath
		     ^^^^^^^^
		     vvvvvvvvvvv
    /bin/../../../../p3/software/mfcf-basics/bin/searchpath
					     ^^^
    vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
    /.software/arch/mfcf-basics/bin/searchpath
	       ^^^^
    vvvvvvvvvvvvv
    /usr/archware/mfcf-basics/bin/searchpath
    /usr/archware/mfcf-basics/bin/searchpath

jmsellens@watmath.waterloo.edu (John M Sellens) (08/25/89)

In article <11257@watcgl.waterloo.edu> idallen@watcgl.waterloo.edu writes:
>Applying absolute to the $path reduces this to just the last symlink.  In
>fact, shouldn't the showpath data files have /.software/local/.admin/bins/bin
>(the local file name) in them instead of the /software rooted path?
>That would get rid of two symlink look-ups even without using absolute.
I always thought that we had decided this long ago.

>It would be nice if showpath had an option to apply the absolute()
>function to absolute pathnames, delete duplicates, and leave the relative
>paths alone.  I'd use it on main machines that weren't dependent on /NFS/.
I always thought this was obvious - I could have sworn that I tried to
make this point a time or two.

My (current) opinion:
- showpath should have a +- option to absolute the paths it spits out.
  It should be on by default i.e. you get absolute paths unless you
  specifically ask for relative paths.
- showpath should have an option to defeat this absoluting on
  particular path prefixes e.g. cgl users would use something like
     setenv PATH `showpath defeat=/NFS/ standard cgl blah blah blah`

This would give the "right" behaviour *by default* for most people
because most people don't have magic changing paths like the cgl
people do.

This would speed things up as Ian! so easily demonstrated.

This would help avoid exceeding symlink limits.

I always just thought that this was obvious - oh well - silly me.