From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from euclid.skiles.gatech.edu (list@euclid.skiles.gatech.edu [130.207.146.50]) by melb.werple.net.au (8.7.5/8.7.3/2) with ESMTP id HAA04614 for ; Thu, 18 Jul 1996 07:20:51 +1000 (EST) Received: (from list@localhost) by euclid.skiles.gatech.edu (8.7.3/8.7.3) id RAA23779; Wed, 17 Jul 1996 17:11:22 -0400 (EDT) Resent-Date: Wed, 17 Jul 1996 17:02:57 -0400 (EDT) From: segal@morgan.com (Morris M. Siegel) Date: Wed, 17 Jul 1996 17:01:57 -0400 Message-Id: <9607171701.ZM10684@morgan.com> X-Mailer: Z-Mail (3.2.1 10oct95) To: zsh-users@math.gatech.edu Subject: Bug in case stmt with '(' Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Resent-Message-ID: <"l4cs4.0.Wn5.1KLxn"@euclid> Resent-From: zsh-users@math.gatech.edu X-Mailing-List: archive/latest/305 X-Loop: zsh-users@math.gatech.edu X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu It seems that when a pattern in a case statement is preceded by the optional '(', the parser is in the wrong state when parsing the statement following the pattern. In particular, an assignment such as 'var=value' is not recognized; instead, zsh complains 'command not found: var=value'. This problem exists in zsh-3.0-pre1 and -pre3 (I never built -pre2), and it seems that -pre3 behaves even worse than -pre1: the following console listing (lines 63-65) shows that "zsh3p3 case3let.ksh" induces the message "segmentation fault (core dumped)"! (As far as I can tell, I built -pre1 and -pre3 the same way.) Moreover (lines 73-75, with zsh-3.0-pre3 as the interactive shell), ". case3let.ksh" not only results in the message "case3let.ksh: command not found: gigo=case '(v)' [2]" but the interpreter then apparently falls through to the next branch of the case statement rather than exiting the case statement. (This falling through is also done by -pre1 but is not shown in the listing below.) 1 $(0) 15:38:50 [39] head case* 2 ==> case2let.ksh <== 3 case v in 4 #(v) gigo="case '(v)'" 5 # echo $gigo;; 6 v) gigo="case 'v)'" 7 echo $gigo;; 8 *) gigo="case '*)'" 9 echo $gigo;; 10 esac 11 12 ==> case3let.ksh <== 13 case v in 14 (v) gigo="case '(v)'" 15 echo $gigo;; 16 v) gigo="case 'v)'" 17 echo $gigo;; 18 *) gigo="case '*)'" 19 echo $gigo;; 20 esac 21 $(0) 15:38:55 [40] sh case2let.ksh # try Bourne shell 22 case 'v)' 23 $(0) 15:39:16 [41] r 2l=3l 24 sh case3let.ksh # try Bourne shell 25 case3let.ksh: syntax error at line 2: `(' unexpected 26 zsh: 10255 exit 2 sh case3let.ksh 27 $(2) 15:39:27 [42] ksh case2let.ksh # try Korn shell 28 case 'v)' 29 $(0) 15:39:46 [43] r 2l=3l 30 ksh case3let.ksh # try Korn shell 31 case '(v)' 32 $(0) 15:39:52 [44] zsh25 case2let.ksh # try 2.5.03 33 case 'v)' 34 $(0) 15:41:11 [45] r 2l=3l 35 zsh25 case3let.ksh # try 2.5.03 36 case3let.ksh: parse error near `gigo="case '(v)'"' [2] 37 case3let.ksh: parse error near `;;' [3] 38 case3let.ksh: parse error near `)' [4] 39 case3let.ksh: parse error near `;;' [5] 40 case3let.ksh: parse error near `)' [6] 41 case3let.ksh: parse error near `;;' [7] 42 case3let.ksh: parse error near `esac' [8] 43 $(0) 15:41:16 [46] zsh26 case2let.ksh # try 2.6-beta20 44 case 'v)' 45 $(0) 15:41:56 [47] r 2l=3l 46 zsh26 case3let.ksh # try 2.6-beta20 47 case3let.ksh: parse error near `gigo="case '(v)'"' [2] 48 case3let.ksh: parse error near `;;' [3] 49 case3let.ksh: parse error near `)' [4] 50 case3let.ksh: parse error near `;;' [5] 51 case3let.ksh: parse error near `)' [6] 52 case3let.ksh: parse error near `;;' [7] 53 case3let.ksh: parse error near `esac' [8] 54 $(0) 15:42:06 [48] zsh3p1 case2let.ksh # try zsh-3.0-pre1 55 case 'v)' 56 $(0) 15:42:45 [49] r 2l=3l 57 zsh3p1 case3let.ksh # try zsh-3.0-pre1 58 case3let.ksh: command not found: gigo=case '(v)' [2] 59 60 $(0) 15:42:50 [50] zsh3p3 case2let.ksh # try zsh-3.0-pre3 61 case 'v)' 62 $(0) 15:43:11 [51] r 2l=3l 63 zsh3p3 case3let.ksh # try zsh-3.0-pre3 64 case3let.ksh: command not found: gigo=case '(v)' [2] 65 zsh: 10287 segmentation fault (core dumped) zsh3p3 case3let.ksh 66 $(139) 15:43:16 [52] ls -sailF core 67 937892978377 8377 -rw-r--r-- 1 segal 8577456 Jul 17 15:43 core 68 $(0) 15:43:29 [53] echo $ZSH_VERSION 69 3.0-pre3 70 $(0) 15:43:41 [54] . case2let.ksh 71 case 'v)' 72 $(0) 15:43:50 [55] r 2l=3l 73 . case3let.ksh 74 case3let.ksh: command not found: gigo=case '(v)' [2] 75 case 'v)' 76 $(0) 15:44:01 [56]