Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!beartrk!ceilidh!dnichols From: dnichols@ceilidh.beartrack.com (DoN Nichols) Newsgroups: comp.sys.att Subject: Re: serious problem w/tcsh binary (was: Re: Shells for SYSV machines) Message-ID: <1991Jun18.021341.846@ceilidh.beartrack.com> Date: 18 Jun 91 02:13:41 GMT References: <1526@gagme.chi.il.us> <1991Jun17.202345.10281@agate.berkeley.edu> Organization: D and D Data, Vienna, VA. Lines: 49 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: --- Black Holes are where God is dividing by zero ---