Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watmath!clyde!rutgers!ames!ucbcad!ucbvax!ulysses!hector!ekrell From: ekrell@hector.UUCP Newsgroups: comp.unix.wizards Subject: Re: symbolic links are a botch Message-ID: <2636@ulysses.homer.nj.att.com> Date: Sun, 7-Jun-87 16:40:28 EDT Article-I.D.: ulysses.2636 Posted: Sun Jun 7 16:40:28 1987 Date-Received: Sun, 7-Jun-87 23:40:30 EDT References: <7724@brl-adm.ARPA> Sender: daemon@ulysses.homer.nj.att.com Reply-To: ekrell@ulysses (Eduardo Krell) Organization: AT&T Bell Labs, Murray Hill Lines: 49 In article <7724@brl-adm.ARPA> rbj@icst-cmr.arpa writes: >I think the key word here is "the". The kernel implements symbolic >links as you describe below; the csh maintains $cwd symbolicly. If you >do `cd /foo/bar' where /foo/bar -> /whiz/bang followed by `cd ..', >$cwd gives /foo while pwd gives /whiz. Thus csh is interpreting `..' >to mean `back' while the kernel takes it to mean `up'. So the question is: where should you end up?. Ignore for a moment the problem of where this special treatment of ".." belongs (shell, kernel, etc). The question is: if a user does a "cd /foo/bar" and then "cd ..", is it reasonable to expect to be in /foo whether /foo/bar is a symbolic link or not?. >In fact, symbolic links are no worse than when root makes links >between directories. The possibility exists for loops The kernel will detect a loop with symbolic links when the count of symbolic links being encountered by namei() while translating a filename exceeds some constant (8, I think). > > What would be the best semantics for ..? > >Exactly what they are now as far as the kernel is concerned. The problem ("cd /foo/bar; cd ..") still remains, then. You could argue that the special treatment for ".." belongs in the shell, but then what about a program that does a chdir or the C preprocessor searching for "../x.h" ? We would really have to change all the programs that deal with filenames and put special code in them to deal with "..". This is clearly wrong. >what happens when you type `cd ..', I can see several alternatives. >Possibly the best is to not treat it specially. Why?. A user that does "cd /foo/bar" and then "cd .." expects to be in /foo. He/she doesn't know and DOESN'T NEED to know that /foo/bar is a symbolic link. Naive users don't even know what symbolic links are. >consider the case of loops, where after `descending' into the same >directorys a few times and realizing what happened, do you want to >retrace your steps in reverse, or go straight up as fast as possible. Let the kernel deal with the loops. As I said before, after a number of symbolic links are encounteres, it gives up with an ELOOP error. Eduardo Krell AT&T Bell Laboratories, Murray Hill {ihnp4,seismo,ucbvax}!ulysses!ekrell