[pdp7-unix] ln ken x x

Will Senn will.senn at gmail.com
Wed Oct 23 08:52:41 AEST 2019


On 10/22/19 3:38 PM, Warren Toomey wrote:
> On Tue, Oct 22, 2019 at 03:09:05PM -0500, Will Senn via pdp7-unix wrote:
>>     Having a hard time wrapping my head around the ln system cat cat
>>     command though! I've read The Evolution of the Unix Time-sharing System
>>     a couple of times and still don't understand why this makes sense:
>>
>> ln dd ken ken
>> ln ken x x
>> rm ken
> Back when there was no . or .., every directory has a link back to dd.
> And you could only reference a file by having access to a directory
> where that file lived.
>
> Thus:
>
> 	ln dd ken ken	# make a link to the 'ken' directory here
> 			# by using our existing access to dd
>
> 	ln ken x x	# make a link to ken/x using our new access
> 			# to ken here
>
> 	rm ken		# no need for this any more!
>
> which is what we now do as: ln /ken/x x
>
> Cheers, Warren

Warren,

That's nuts.

Here's what I figured out based on your hint. When I first login there's 
no . defined.

@ ls
.       ?

Ahah! The . isn't an entry in the directory listing! It's a badfile 
name, cuz there isn't a . until we create it.

There is a directory of directories called dd and it contains entries 
for itself, core, system, ken, and dmr.

@ ls dd
dd
core
system
ken
dmr

Only dd and system are accessible by default:

@ ls core
core    ?
@ ls ken
ken     ?
@ ls dmr
dmr     ?
@ ls system
dd
...

Here's where my understanding gets fuzzy... In order to see one of these 
directory's contents, you have to have a link to it residing in your 
user directory. If you log in as dmr, it is in dmr. If you log in as 
ken, it is in ken. So, whenever you type:

ln dirname name1 name2

It creates a link in dmr or ken, depending on which you are, called 
name2 that refers to name1 residing in the dirname directory.

ln dd core core
@ ls core
@

nothing shows, but no error, core's special:

@ ls -l dd
00001 srwrw 01 777 00000 core

@ ln dd ken ken
@ ls ken
dd
...
ken

As expected, got a ken entry in ken.

ln dd dmr dmr
@ ls dmr
dd
...

Also as expected, didn't get a dmr entry in dmr.

but,

@ ls ken
dd
...
ken
dmr

Got a dmr entry in ken!

ls is special in that it looks for . to be defined, it if isn't, it 
thinks it's a badfile, otherwise, glorious success:

ln dd ken .

@ ls
dd
...

chdir works if you realize that chdir can only change to dirs that are 
directly adjacent to the current one (starting in dmr or ken):

login: ken
password: ken
@ chdir ken
ken     ?

Already in ken.

@ chdir dmr
dmr     ?

dmr is in dd, not ken.

@ chdir dd

dd is in ken.

@ chdir ken

ken is in dd.

@ chdir dd dmr

dd is in ken, dmr is in dd.

now od dd and od ken make sense when combined with ls -l.

Wow. Thankfully, they fixed this insanity in future releases :). I heart 
vintage unix.

I thought since I had issues thinking this through, that I'd share the 
musings in case someone comes later wanting to know they aren't alone.

If I'm off somewhere in the description, please correct me!

Thanks,

Will






-- 
GPG Fingerprint: 68F4 B3BD 1730 555A 4462  7D45 3EAA 5B6D A982 BAAF



More information about the pdp7-unix mailing list