dglasser@yale.ARPA (Danny Glasser) (10/05/84)
Here's an interesting 4.2BSD csh bug: Let's say that /foo/lib/bar is a soft link to /usr/lib/bar (which is a directory), where /foo/lib and /usr/lib are distinct directories. I say the following: % cd /foo/lib/bar % pwd /usr/lib/bar % echo $cwd /foo/lib/bar % cd .. % pwd /usr/lib % echo $cwd /foo/lib Note that the "cwd" shell variable is not set properly. The problem is with the differing notions of what the parent directory is. [If this bug has already been reported and I missed it, I apologize for rebroadcasting it.] Danny Glasser {decvax,ima,allegra}!yale!dglasser Glasser-Daniel@YALE.ARPA DGLASSER@YALECS (BITNET)
gwyn@brl-tgr.ARPA (Doug Gwyn <gwyn>) (10/08/84)
Anyone who decides to port the UNIX System V Release 2 Bourne shell to 4.2BSD should be on the lookout for a similar problem with the "pwd" shell built-in. Aren't symbolic links to directories wonderful?
chris@pixutl.UUCP (chris) (10/08/84)
The following changes to 'sh.dir.c' will take care of the problem:
1) in dfollow(),
1.1) add this declaration:
char *realdname();
1.2) before 'dcanon(cp);' insert:
cp = realdname(cp);
2) then add this routine:
char *
realdname(d)
char *d;
{
struct stat st;
char *getwd();
char path[BUFSIZ];
lstat(d, &st);
if((st.st_mode & S_IFMT) != S_IFLNK)
return(d);
printd = 1;
return(savestr(getwd(path)));
}
--
Chris Bertin : (617) 657-8720 x2318
Pixel Computer Inc. :
260 Fordham Rd. : {allegra|ihnp4|cbosgd|ima|genrad|amd|harvard}\
Wilmington, Ma 01887 : !wjh12!pixel!pixutl!chris
root@uokmet.UUCP (10/22/84)
The solution presented by Chris Bertin solves the same problem with the 2.9bsd system. Kevin W. Thomas Univ. of Oklahoma School of Meteorology Norman, OK 73019 UUCP: ...!ctvax!uokvax!uokmet!kwthomas