🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: net.bugs.2bsd
Article #54

C shell bug

#54
From: hao!pag
Date: Wed, 05 May 1982 13:48
22 lines
1061 bytes
There is a bug in all versions of the C shell that I have tested.
It concerns the spacing of nested "if" statements when the outer
"if" condition is false.  The following will demonstrate the problem:

if (0 == 1) then
    if(a == b) then
	echo hello
    endif
    echo This should not be executed.
endif

Note that there is no space after the 2nd "if".
When executed the "This should not be executed" prints.  This happens
because the "endif" of the interior "if" is matched to the first "if".
If the 2nd line is replaced with:
    if (a == b) then	#note spacing around conditional
everything works fine.  I suspect, without having checked the source,
the parsing method used to find the matching "endif" to first condition
is at fault.  If someone has already fixed this, let us know.

--peter gross
ucbvax!menlo70!hao!pag
Technical Details
Message-ID: <anews.Ahao.235>
Path: arc1-ca.pugleaf.net!utzoo!decvax!cca!hplabs!menlo70!hao!pag@sri-unix

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!decvax!cca!hplabs!menlo70!hao!pag@sri-unix
From: hao!pag@sri-unix
Newsgroups: net.bugs.2bsd,net.bugs.4bsd
Subject: C shell bug
Date: Wed, 05 May 1982 13:48:57 +0000
Message-ID: <anews.Ahao.235>