Behaviour of ".." with symbolic links

Phong Vo kpv at ulysses.UUCP
Wed Mar 28 01:25:00 AEST 1984


The ".." operator in pre-4.2BSD UN*Xes is inherently a rooted tree operator
because in a rooted tree parental relationship is functional. That is, the map
parent(x) always defines a "unique" value for any given file or directory x.
Note that "unique-ness" is the desired property. With symbolic links, the
directory structure becomes a directed graph, and uniqueness of parents of
nodes can no longer be guaranteed unconditionally but must be parametrized
in some ways. In my experience with a rather different interactive network
traversal problem, the following strategy seems to work best:
	1. Assume that the network is rooted (eg, "/") and the root is the entry
	   point into the network.
	2. Keep the stack of nodes traversed from the root to the current node.
	3. Define parent(AnyNodeOnTheStack) to be its predecessor on the stack.
The above strategy works well with step-wise movements in the network.
Since the only other way to `cd' in UNIX is to specify the full path name,
the stack can be recalculated when such a move is made.
However, the problem as I see it is not in changing csh, ksh,
and other programs to reflect the desired effect of ".." whatever that may be.
Rather, the changes ought to be implemented at the level of chdir(),
open(), creat(), etc. since it is really these routines that interpret
the directory structure.
	Phong Vo



More information about the Comp.unix mailing list