Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!spool.mu.edu!cs.umn.edu!kksys!pwcs!minnow!kjt From: kjt@minnow.sp.unisys.com (Kevin Thomas) Newsgroups: comp.bugs.sys5 Subject: Csh if statement missing endif bug Message-ID: <1991May31.153937.16414@minnow.sp.unisys.com> Date: 31 May 91 15:39:37 GMT Sender: kjt@minnow.sp.unisys.com (Kevin Thomas) Organization: Unisys Corporation Lines: 38 A bug in the version of csh we are running recently reared its ugly head. The problem occurs when a csh is started from an application such as vi, and the .cshrc contains an if/then/endif mismatch. Under these conditions the csh process prints an error message when it detects the missing endif, but it then rapidly grows in size. The csh never runs the command as it was asked to do, and is probably trapped in a recursive loop. Killing the process allows the application to continue. The .csh contains lines like the following: if ($?prompt) then set ignoreeof ... The if/then should be terminated with an endif, but it is not. When the user logs in, the csh doesn't complain at all. This is probably because the if expression evaluates to true. If the user enters vi and enters the command ":!ls" the csh prints an error message about the missing endif, and then goes into the loop described above. I suppose that vi is attempting something like: execlp("csh","csh","-c","ls",NULL); Therefore, the if expression in the .cshrc evaluates to false. Csh must be trying to skip to the end of the if/then/endif statement, but goes insane. Our computer is a Unisys 5000/80 running Unix System 5.3. The OS release number is 6.03.00. I'd be interested to know how widespread is this problem. If you'd like to give the above example a try on your OS and mail me the results, I will summarize for the net. -- Kevin Thomas kjt@minnow.sp.unisys.com Unisys Corporation ...!pyramid!pwcs!minnow!kjt