[7233] in Athena Bugs
[daemon@ATHENA.MIT.EDU : More nifty afs stuff (bug in pwd?)]
daemon@ATHENA.MIT.EDU (daemon@ATHENA.MIT.EDU)
Sun Mar 3 03:41:36 1991
From: qjb@ATHENA.MIT.EDU
Date: Sun, 3 Mar 91 03:41:26 -0500
To: kkkken@ATHENA.MIT.EDU
Cc: bugs@ATHENA.MIT.EDU
In-Reply-To: [7230] in bugs
Sorry about responding to something in "bugs". I'm only
responding because I had once been puzzled by this same thing
and investigated it.
> hey, here's another good way to confuse your workstation:
>
> cd ~
> fs mkmount lose user.kkkken
> repeat 10000 cd lose
>
> It sat there for a long time, and finally did really lose:
>
> athena% cd /afs/athena/user/k
> athena% pwd
> /afs/athena.mit.edu/user/k
> athena% cd kkkken
> athena% pwd
> /
> athena% echo $cwd
> /afs/athena/user/k/kkkken
>
> It's actually pwd that's lying (as revealed by stat).
>
> Should afs prevent you from mounting volumes under themselves?
The problem is that getwd in the c library basially decides that
you are at / when . and .. are the same even if . and / aren't
the same. As far as it is concerned, . and .. are the same when
the inode and device numbers both match.
Everything within /afs shares a device number; afs mountpoints
don't count as separate devices. This is the same phenomenon
that prevents us from easily changing find to prevent it from
traversing mountpoints (the behavior of -xdev). We could do
what delete does and call an afs pioctl to check to make sure
that the current directory is not an afs mountpoint, but I
seriously doubt we'd want to go adding code like that to the C
library! Someone else may have a better idea, but the fix that
occurs to me is to remove the code that checks to see whether .
== .. and replace it with code that keeps track of how many
levels of directories we've gone through. This would make getwd
similar to following symbolic links. I'm not fully convinced
that this fix would be desirable or that the problem is worth
fixing.
Anyway, further discussion of this, if needed, should probably
take place outside of this forum.
--Jay