/tmp... (null pathnames)

Joseph S. D. Yao jsdy at hadron.UUCP
Sun Nov 10 03:29:38 AEST 1985


In article <742 at whuxl.UUCP> mike at whuxl.UUCP (BALDWIN) writes:
[Attributions not included...]
>> 	Well, yes, more-or-less;  "the null file name refers to the current
>> directory" [The UNIX Time-Sharing System], and repeated slashes are ignored,
>> but (a) is this anything but a kludge so that "/" works? and (b) apart from
>> "/", has anyone ever used this facility in real-life?
>> 
>> 	V7 (but not some other systems) even allows "fred///" as a synonym
>> for "fred" (an ordinary file);  I can see no reason why this, and "///tmp//"
>> and so on, should not be errors.
[And Baldwin on pathnames ...]

This is an aside from the main discussion.  A lot of this confusion
is generated by the fact that almost everybody teaches that, e.g.,
in a name like "/usr/bin/glumph", there are directories (nodes)
named "usr" and "bin", and a file named "glumph".  This is exactly
wrong.

Shocked?  Surprised?  Don't be.  If those were their names, why
can we have links to them named "." or "glomph"?  (And remember how
hard it was the last time you tried to explain links as alternate
names to somebody?)

I'm not going to say that the following is easier to understand, or
the best way to explain things to people.  It just happens to be
right.

In the name "/usr/bin/glumph", each file or directory (node) is
named "/" or "".  That's all.  It's the connection ("link")
between one and the next that is named "usr" or "bin" or "glumph".
The picture (attempted later below) that labels nodes with these
names should always label links with these names!  But, this is
why multiple "/"s mean the same as one (or none, where appropriate).
I just said they were "names", but they are actually separators for
the real names, the names of the links.  And if there is nothing
between them, then they reference the null link "", which goes
nowhere (hence "" is equivalent in some systems to ".").

Here goes the attempt at a pretty picture:

			_(/)_
		   etc_/  |  \_bin
		    _/    |    \_
		  _/  usr |      \_
	       (/)	_(/)_	   (/)
		      _/  |  \_
		 adm_/    |    \_bin
		  _/  lib |      \_
	       (/)	 (/)___	   (/)_
			       \___    \_
			    glomph \___	 \_glumph
				       \___\_
					     ()

OK, Picasso I'm not.  Next time I'll send along a rasterized
image.		;-)
-- 

	Joe Yao		hadron!jsdy at seismo.{CSS.GOV,ARPA,UUCP}



More information about the Comp.unix.wizards mailing list