zsh-workers
 help / color / mirror / code / Atom feed
* BUG:  Parser unwinding (lack thereof)
@ 2015-05-06  7:08 Bart Schaefer
  2015-05-06 14:42 ` Bart Schaefer
  0 siblings, 1 reply; 3+ messages in thread
From: Bart Schaefer @ 2015-05-06  7:08 UTC (permalink / raw)
  To: zsh-workers

This probably needs to be fixed before we release 5.0.8:

torch% print -l ${            
braceparam> ^C
torch% print -l ${
braceparam braceparam> ^C
torch% print -l ${
braceparam braceparam braceparam> ^C
torch% print -l ${
braceparam braceparam braceparam braceparam> ^C
torch% (    
braceparam braceparam braceparam braceparam subsh> 


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: BUG:  Parser unwinding (lack thereof)
  2015-05-06  7:08 BUG: Parser unwinding (lack thereof) Bart Schaefer
@ 2015-05-06 14:42 ` Bart Schaefer
  2015-05-06 14:55   ` Peter Stephenson
  0 siblings, 1 reply; 3+ messages in thread
From: Bart Schaefer @ 2015-05-06 14:42 UTC (permalink / raw)
  To: zsh-workers

On May 6, 12:08am, Bart Schaefer wrote:
} Subject: BUG:  Parser unwinding (lack thereof)
}
} torch% print -l ${            
} braceparam> ^C
} torch% print -l ${
} braceparam braceparam> 

This seems to handle it:


diff --git a/Src/lex.c b/Src/lex.c
index c929bb9..5b6d3a6 100644
--- a/Src/lex.c
+++ b/Src/lex.c
@@ -1345,8 +1345,11 @@ gettokstr(int c, int sub)
 	    break;
     }
   brk:
-    if (errflag)
+    if (errflag) {
+	while(bct-- >= in_brace_param)
+	    cmdpop();
 	return LEXERR;
+    }
     hungetc(c);
     if (unmatched)
 	zerr("unmatched %c", unmatched);


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: BUG:  Parser unwinding (lack thereof)
  2015-05-06 14:42 ` Bart Schaefer
@ 2015-05-06 14:55   ` Peter Stephenson
  0 siblings, 0 replies; 3+ messages in thread
From: Peter Stephenson @ 2015-05-06 14:55 UTC (permalink / raw)
  To: zsh-workers

On Wed, 6 May 2015 07:42:21 -0700
Bart Schaefer <schaefer@brasslantern.com> wrote:
> On May 6, 12:08am, Bart Schaefer wrote:
> } Subject: BUG:  Parser unwinding (lack thereof)
> }
> } torch% print -l ${            
> } braceparam> ^C
> } torch% print -l ${
> } braceparam braceparam> 
>
> This seems to handle it:

That's obviously the effect of returning earlier on an error,
at which point stuff like hungetc() is unnecessary and bug-prone,
since 34817 / f1c702f2a4.

I don't see anything else that might need moving up --- I presume the
state of lexbuf is irrelevant, too.

pws


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-05-06 15:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-06  7:08 BUG: Parser unwinding (lack thereof) Bart Schaefer
2015-05-06 14:42 ` Bart Schaefer
2015-05-06 14:55   ` Peter Stephenson

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).