newgrp/C-shell directory stack bug
teklabs!ogcvax!root
teklabs!ogcvax!root
Thu Nov 4 14:52:49 AEST 1982
Executing the newgrp command will create anomalies in the new
directory stack, if your login shell is the C-shell. The current
directory does not actually change, but the new directory stack is set
to ~, as is the cwd variable. Thus, dirs incorrectly reports the
current directory. A far worse problem can occur when pushd and popd
are subsequently used:
% cd /tmp < Get out of home directory >
% newgrp XXX
(A new C-shell is execl'd)
% pwd
/tmp < This is correct >
% dirs
~ < INCORRECT >
% pushd subdir < Assuming there is a "subdir" in /tmp >
~/subdir < INCORRECT, but we're in /tmp/subdir >
% pwd
/tmp/subdir < Correct >
% dirs
~/subdir < INCORRECT >
% pushd / < Push anything on >
/ ~/subdir
% popd < Try to pop it back off >
/usr/username/subdir: No such file or directory
%
When the final popd is attempted, the ~ is now interpreted as
username's home directory, and ~/subdir doesn't exist. I'm sorry that
I don't have time to attempt a solution. A crutch would be to cd or
pushd into ~ before using the newgrp command.
Bruce Jerrick
Oregon Graduate Center
CSNet: bruce at Oregon-Grad
UUCP: ...teklabs!ogcvax!bruce
More information about the Comp.bugs.4bsd.ucb-fixes
mailing list