File Sys Hierarchies

Root Boy Jim rbj at dsys.ncsl.nist.gov
Thu Jun 29 09:40:17 AEST 1989


? From: Duane Hesser <dhh at nwnexus.wa.com>

? As for the original posters notion about "/root", I will point out
? that the root directory is a directory like any other, that it has
? a name ("/"), and that it serves not only to provide mount points,
? but normally contains some rather important FILES as well (e.g.
? /vmunix [or, if you happen to have a pdp11, /unix], /boot, and
? let's not forget /.profile).  This is not to mention ordinary,
? not-mounted DIRECTORIES like /etc, /bin, /lib.  Perhaps I missed
? his point?

No, it does not have a name. A name is a character string you can look
up in a directory. The root is treated as a special case by the
kernel.  As you know, pathnames beginning with a `/' are treated as
absolute; otherwise they are relative to the current directory. To
translate a pathname, the kernel uses either the root or at the
current directory as a reference point, and for each component seen,
looks it up relative to that reference point, and makes the inode
found the new reference point. When all names are used up, the
inode found is returned.

Of course it works to say `/'; things would be broken if it didn't.
My point is that the `/' is really used to denote an absolute path,
so the real name of the root is perhaps "". You can get around that
by claiming that its real name is `/.' if you like.

But however you might try, there is just no getting around the fact
that the root is a special case. It is too easy to generate `//' at
the beginning of a name accidently in shell scripts or makefiles.
Furthermore, consider a script which automatically makes dumps:

	cd /usr/adm
	foreach fs (/ /usr /u ...)
		dump un$1 $fs			# $1 is dump level
		mt bsf 2
		mt fsf
		restore tv > dump.$1.$2.$fs:t	# $2 is date YYMMDD
		mt fsf
	end

For the root, the thing after the third period evaluates to "".
Perhaps this is no big deal, but I hope it illustrates the point.
No flames for using a csh script, please.

Another annoying thing is that the superuser's home directory is `/'.
This make it difficult to have a private bin directory and use the
same .cshrc and .login scripts as my user account.

Please don't respond with microsuggestions about how easy it is to
do this or that; I know all the tricks, and I can live with things the way
things are. This is a forest posting, don't talk to me about trees. 

? Duane H. Hesser
? Future Systems
? dhh at nwnexus.wa.com

	Root Boy Jim is what I am
	Are you what you are or what?



More information about the Comp.unix.wizards mailing list