Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!munnari!mwp From: mwp@munnari.oz (Michael W. Paddon) Newsgroups: comp.unix.wizards Subject: Re: Symbolic Links Message-ID: <1809@munnari.oz> Date: Thu, 3-Sep-87 02:55:50 EDT Article-I.D.: munnari.1809 Posted: Thu Sep 3 02:55:50 1987 Date-Received: Sat, 5-Sep-87 10:16:10 EDT References: <1254@mhres.mh.nl> Organization: Comp Sci, Melbourne Uni, Australia Lines: 58 in article <1254@mhres.mh.nl>, jv@mhres.mh.nl (Johan Vromans) says: > > At any moment, I can issue the command "pwd" which gives me the > current directory. If I am at "/usr/include/sys" then I can deduce what > my parent is by removing the last element of the name of the current > directory (in the above example: "/usr/include"). Sounds consistent > and easy to me. > > Imagine, my system (HP9000/530 with HP-UX, a very good System V.2 with > Berkeley enhancements) does not have "." and "..": > > %ls -al > total 158 > -rw------- 1 jv bsp 422 Apr 1 19:41 .login > -rw-rw-rw- 1 jv bsp 263 Sep 1 13:32 .newsrc > -rw-rw-rw- 1 jv bsp 0 Sep 1 13:36 .pnewsexpert > -rw-rw-rw- 1 jv bsp 26 Sep 1 13:31 .rnlast > -rw-rw-rw- 1 jv bsp 58 Aug 27 09:49 .rnsoft > -rw-r--r-- 1 jv bsp 14 May 23 23:04 .signature > drwxrwxrwx 1 jv bsp 0 Aug 18 09:39 News > drwxr-xr-x 1 jv bsp 504 Jun 13 01:05 icon > drwxr-xr-x 1 jv bsp 912 Sep 1 13:31 maildir > % > > No dot, no dot-dot, and directories have only one link ... Of course, you > can access "." and ".." from system calls - it will do what you expect. > > -- > Johan Vromans | jv@mh.nl via European backbone > Multihouse N.V., Gouda, the Netherlands | uucp: ..{seismo!}mcvax!mh.nl!jv I hope you are not suggesting that we don't need '.' and '..' for the above reasons. The routine getwd(3) [and thereby pwd] use the '..' link to trace their way back to the root of the tree to yield the true name of the current directory. The argument for using pwd to obviate the need for '..' is therefore rather circular. Note that there is no easy way to find the *real* path of a file or directory if some of the proposed changes to symbolic links are implemented in the kernel. The kernel only knows, in this case, one possible path -- the one you used to get there. Given this problem, how would you know if you were removing the real directory or just a symbolic link? As has been stated before, the solution is to regard symlinks as seperate objects with their own semantics. The '.' link is just as useful when a user wants to run an executable in the current directory instead of the first instance of that name in his PATH envariable. The only other solution -- putting '.' first in the path -- is an obvious security risk. mwp === =========================== UUCP: {seismo,mcvax,ukc,ubc-vision}!munnari!mwp ARPA: mwp%munnari.oz@seismo.css.gov CSNET: mwp%munnari.oz@australia