Symlinks and ..

Richard O'Keefe ok at mudla.cs.mu.OZ.AU
Mon Nov 20 17:21:45 AEST 1989


This isn't a question, it's a tip.

I have a program which normalises file names so that I can tuck them away
in a safe place and use them again later even if I'm in a different
directory &c &c.  One thing that this program did was to change
	<prefix>/<directory>/..
to	<prefix>
The way I handled things like "../../rule" was to prepend the current
directory and then just apply this rule, so e.g.
	/tip/ok/../../vmunix	-> /vmunix

THIS WAS A MISTAKE.  The rule is INVALID when <prefix>/<directory> is a
symlink.  In my case, there is some piece of black magic so that
	/tip/ok
is really
	/mount/mullauna/tip/ok
so that everything else in the system thinks that
	/tip/ok/../../vmunix	-> /mount/mullauna/vmunix

I am less found of symlinks than I used to be.



More information about the Comp.unix.questions mailing list