serious problem w/tcsh binary (was: Re: Shells for SYSV machines)

DoN Nichols dnichols at ceilidh.beartrack.com
Tue Jun 18 12:13:41 AEST 1991


In article <1991Jun17.202345.10281 at agate.berkeley.edu> et at 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 at ceilidh.beartrack.com>
	--- Black Holes are where God is dividing by zero ---



More information about the Comp.sys.att mailing list