From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29353 invoked from network); 4 Feb 2000 09:35:02 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 4 Feb 2000 09:35:02 -0000 Received: (qmail 27697 invoked by alias); 4 Feb 2000 09:34:50 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 9558 Received: (qmail 27574 invoked from network); 4 Feb 2000 09:34:36 -0000 Date: Fri, 4 Feb 2000 10:34:26 +0100 (MET) Message-Id: <200002040934.KAA22630@beta.informatik.hu-berlin.de> From: Sven Wischnowsky To: zsh-workers@sunsite.auc.dk In-reply-to: Peter Stephenson's message of Thu, 03 Feb 2000 18:30:20 +0000 Subject: Re: Funny bug when autoloading with syntax error Peter Stephenson wrote: > Autoload the following function: > > if (( 1 )): then # note colon instead of semicolon > true > fi > > This loads silently, unlike trying it at the command line which gives a > parse error near `fi', which is not unexpected. `which fn' gives > > fn () { > if (( 1 )) > then > : then > fi > true > } > > This is, not to put too fine a point on it, wrong. But of course the bug is that it doesn't complain about a parse error, right? I hope that all syntactically correct strings end with a token of ENDINPUT in parse_list(). The hunk in exec.c makes loadautofn() treat empty functions in the same way as execautofn(). Bye Sven diff -ru ../z.old/Src/exec.c Src/exec.c --- ../z.old/Src/exec.c Fri Feb 4 09:53:28 2000 +++ Src/exec.c Fri Feb 4 10:29:34 2000 @@ -3097,6 +3097,8 @@ zerr("%s: function definition file not found", shf->nam, 0); return 1; } + if (!prog) + prog = &dummy_eprog; PERMALLOC { shf->funcdef = dupeprog(stripkshdef(prog, shf->nam)); } LASTALLOC; diff -ru ../z.old/Src/parse.c Src/parse.c --- ../z.old/Src/parse.c Fri Feb 4 09:53:32 2000 +++ Src/parse.c Fri Feb 4 10:25:35 2000 @@ -357,7 +357,11 @@ incmdpos = 1; yylex(); ret = par_list(); - if (tok == LEXERR) { +#if 0 + if (tok == LEXERR) +#endif + if (tok != ENDINPUT) + { yyerror(0); return NULL; } -- Sven Wischnowsky wischnow@informatik.hu-berlin.de