[net.bugs.4bsd] newgrp/C-shell directory stack bug

root (11/04/82)

   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@Oregon-Grad
        UUCP:   ...teklabs!ogcvax!bruce