Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.3 4.3bsd-beta 6/6/85; site hadron.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!genrad!panda!talcott!harvard!seismo!rlgvax!hadron!jsdy From: jsdy@hadron.UUCP (Joseph S. D. Yao) Newsgroups: net.unix-wizards Subject: Re: /tmp... (null pathnames) Message-ID: <65@hadron.UUCP> Date: Sat, 9-Nov-85 12:29:38 EST Article-I.D.: hadron.65 Posted: Sat Nov 9 12:29:38 1985 Date-Received: Mon, 11-Nov-85 05:44:22 EST References: <2397@brl-tgr.ARPA> <742@whuxl.UUCP> Reply-To: jsdy@hadron.UUCP (Joseph S. D. Yao) Organization: Hadron, Inc., Fairfax, VA Lines: 59 Summary: Really, explaining pathnames differently! In article <742@whuxl.UUCP> mike@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@seismo.{CSS.GOV,ARPA,UUCP}