Subject: Re: csh parsing problem on -current
To: None <current-users@netbsd.org>
From: Christos Zoulas <christos@zoulas.com>
List: current-users
Date: 05/13/2004 15:39:39
In article <20040513100028.GA19913@medusa.sis.pasteur.fr>,
Nicolas Joly <njoly@pasteur.fr> wrote:
>
>Hi,
>
>I recently noticed that some csh scripts that worked on NetBSD 1.6GZ,
>last time i checked, does not work anymore on NetBSD 2.0E (and
>probably 2.0_BETA).
>
>Here follow a small script that demonstrate the problem :
>
>njoly@hal [~/tmp]> cat min.csh
>#!/bin/csh
>
>while ( $#argv >= 1 )
> echo "** $argv[1] **"
> switch ( "$argv[1]" )
> case "c":
> breaksw
> case "b":
> foreach f ( 1 2 3 )
> end
> breaksw
> case "a":
> breaksw
> endsw
> set argv = ($argv[2-])
>end
>njoly@hal [~/tmp]> /bin/csh min.csh a b c
>** a **
>** b **
>** c **
>end: Not in while/foreach.
>njoly@hal [~/tmp]> /bin/csh min.csh a
>** a **
>njoly@hal [~/tmp]> /bin/csh min.csh b
>** b **
>njoly@hal [~/tmp]> /bin/csh min.csh c
>** c **
>end: Not in while/foreach.
>njoly@hal [~/tmp]> uname -a
>NetBSD hal.sis.pasteur.fr 2.0E NetBSD 2.0E (GENERIC.MP) #0: Wed May 12
>17:13:58 CEST 2004
>njoly@lanfeust.sis.pasteur.fr:/local/src/NetBSD/obj/i386/sys/arch/i386/compile/GENERIC.MP i386
>
>I tracked down this problem, which is present in `bin/csh/func.c'
>since revision 1.27; with this small piece of code :
>
>@@ -627,6 +629,13 @@
> return;
> break;
> case T_END:
>+ if (type == T_BRKSW) {
>+ wp = whyles;
>+ if (wp) {
>+ whyles = wp->w_next;
>+ wpfree(wp);
>+ }
>+ }
> if (type == T_BREAK)
> level--;
> break;
>
>Removing this few lines restore the expected behaviour.
>
I just committed a fix for this.
christos