[comp.os.os9] Link byte not fuly supported !!!

zambotti@wpowz.enet.dec.com (Walter Zambotti DEC) (06/28/91)

Hi there guys & girls, (do we have any OS9 ladies about??)

I'm finally happy with the way my new ln(1) command works and so will
post it over the week end.

Although it works fine and (hopefully) doesn't have any bugs there are a
few parculiarites regarding how other OS9 utility programs handle
links.

For instance I have a PD ls(1) utility that supports recursive directory
listings.  Well with links in your file structure this can go wrong. 
Assuming the following simple directory structure :

                                                        /D0
                                                           |
                                      Dir1                               Dir2
                                         |                              
|
                                link_to_D0

Now if we do this :

        ls /d0
        Dir1    Dir2

        chd Dir1
        ls link_to_d0
        Dir1    Dir2

Which is what we would expect to see.  But when a recursive ls command
is issued we see this :

        ls -r /d0
        Dir1    Dir2
        Dir1:
            link_to_d0
            link_to_d0:
                Dir1    Dir2
                Dir1:
                    link_to_d0
                    link_to_d0:
                    ...
        error 207 (out of memory I think)

Unfortunately the ls(1) doesnt keep track of the directory LSN's so that
when it comes accross a directory which is actually an upward link it
should say this is just a link and move on.

You can live this problem but you cant live with the next one.  Now that
we have our upward/backward link to a previous directory it becomes
impossible to deldir any directory in the recursive chain. 

In our above example it becomes impossible to do :

	deldir /d0/dir1
	or
	attr /d0/dir1/link_to_d0 -d

Because the deldir command would delete everyfile off the disk when it
tried to delete all files beneath the link_to_d0 directory.  And the
attr command wont let you set "-d" until you first delete the /d0 and
Dir1 directories which of course is impossible.

So creating links is no problem.  Getting rid of simple file links is no
problem (I checked this).  Getting rid of directory links is painfull
though.

What this probably means is a special rm(1) and ls(1) commands are
needed that take links into consideration and possibly a rmdir(1)
command as well.

Anyway all this means is more programming and good fun lay ahead!