[comp.sys.att] serious problem w/tcsh binary

et@tornado.Berkeley.EDU (Eric Thompson) (06/18/91)

[someone writes]:
>Instead of bash, I am now using tcsh, which i was able to ftp the
>binaries for from tesla.ee.cornell.edu, or (so I am told) from
>tut.cis.ohio-state.edu, or possibly cheops.cis.ohio-state.edu.  I
>forget which of the two sites is supposed to have it available.

I got the 3b2 tcsh binary from ee.cornell.edu, and it works fine,
EXCEPT that whenever I'm ROOT (on the console or su'd), it will
hang if I use a command string that includes a pipe to grep.  At
least, that's all that it's hung on so far.  It doesn't seem to
care which grep, either (grep,egrep,fgrep).

For example:

	# who /etc/wtmp | grep someuser
	# ps -ef | grep someprocess

The results will show up, but then when it should EXIT and return to
the prompt, it just hangs.  Using 'ps' from another terminal shows
just -tcsh running on the hung terminal.  The hung -tcsh is killable,
and this is the current solution.

Strangely, this doesn't happen if the user is NOT root.

Anyway, this isn't enough to keep me from using tcsh as the root shell,
but it makes me wonder if there are any other strange things lurking
in the binary that will break...

Help if you can!  :-)

thanks
Eric

dnichols@ceilidh.beartrack.com (DoN Nichols) (06/18/91)

In article <1991Jun17.202345.10281@agate.berkeley.edu> et@tornado.Berkeley.EDU (Eric Thompson) writes:

	[ ... ]
>
>I got the 3b2 tcsh binary from ee.cornell.edu, and it works fine,
>EXCEPT that whenever I'm ROOT (on the console or su'd), it will
>hang if I use a command string that includes a pipe to grep.  At
>least, that's all that it's hung on so far.  It doesn't seem to
>care which grep, either (grep,egrep,fgrep).
>
>For example:
>
>	# who /etc/wtmp | grep someuser
>	# ps -ef | grep someprocess
>
>The results will show up, but then when it should EXIT and return to
>the prompt, it just hangs.  Using 'ps' from another terminal shows
>just -tcsh running on the hung terminal.  The hung -tcsh is killable,
>and this is the current solution.
>
>Strangely, this doesn't happen if the user is NOT root.

	I don't promise that I haven't misinterpreted things, but I seem to
remember a discussion in comp.unix.wizards a couple of years ago (When that
was all that I got of netnews - and in digest form only so I read it all :-).

	The gist of that discussion was that tcsh would fail due to a race
condition in fork() which is avoided on a BSD machine with vfork().  A small
program would complete and exit before tcsh would do its wait().  Grep on my
machine is 6176, fgrep 4312, and egrep 10044.  All are shared libs, and
stripped, so load quickly.  I don't have tcsh on this system (AT&T UNIX-PC)
but manage to make do with ksh :-)

	Just as an experiment, try adding a sleep(1) to see if that makes a
difference.

	# who /etc/wtmp | ( grep someuser; sleep 1 )

If this works, it is probably that race condition.  I don't remember any
solution coming out of this discussion, but I didn't have tcsh, and so was
less interested than I could otherwise have been.

	Good Luck
		DoN.
-- 
Donald Nichols (DoN.)		| Voice (Days):	(703) 664-1585
D&D Data			| Voice (Eves):	(703) 938-4564
Disclaimer: from here - None	| Email:     <dnichols@ceilidh.beartrack.com>
	--- Black Holes are where God is dividing by zero ---