zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <p.stephenson@samsung.com>
To: Zsh hackers list <zsh-workers@zsh.org>
Subject: Re: PATCH: case pattern parsing
Date: Tue, 21 Jun 2016 15:44:32 +0100	[thread overview]
Message-ID: <20160621154432.0f165444@pwslap01u.europe.root.pri> (raw)
In-Reply-To: <19007.1466508129@thecus.kiddle.eu>

On Tue, 21 Jun 2016 13:22:09 +0200
Oliver Kiddle <okiddle@yahoo.co.uk> wrote:
> I noticed a bug with case statements which git bisect tracks to this
> change (workers/35168 or 52aeb9aa). It occurs with a fall-through at the
> end of the case statement:
> 
>   case whatever in
>     *) ;&
>   esac

diff --git a/Src/loop.c b/Src/loop.c
index 19d7f73..fa7602e 100644
--- a/Src/loop.c
+++ b/Src/loop.c
@@ -660,7 +660,7 @@ execcase(Estate state, int do_exec)
 	    execlist(state, 1, ((WC_CASE_TYPE(code) == WC_CASE_OR) &&
 				do_exec));
 	    while (!retflag && wc_code(code) == WC_CASE &&
-		   WC_CASE_TYPE(code) == WC_CASE_AND) {
+		   WC_CASE_TYPE(code) == WC_CASE_AND && state->pc < end) {
 		state->pc = next;
 		code = *state->pc++;
 		next = state->pc + WC_CASE_SKIP(code);
diff --git a/Test/A01grammar.ztst b/Test/A01grammar.ztst
index 7eedfa6..394480c 100644
--- a/Test/A01grammar.ztst
+++ b/Test/A01grammar.ztst
@@ -283,6 +283,14 @@
 >2
 >3
 
+  case whatever in
+  (*) print yeah, right ;&
+  esac
+  print but well
+0:'case', redundant final ";&"
+>yeah, right
+>but well
+
 ## Select now reads from stdin if the shell is not interactive.
 ## Its own output goes to stderr.
   (COLUMNS=80 LINES=3


      reply	other threads:[~2016-06-21 14:54 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-17 20:53 Peter Stephenson
2016-06-21 11:22 ` Oliver Kiddle
2016-06-21 14:44   ` Peter Stephenson [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160621154432.0f165444@pwslap01u.europe.root.pri \
    --to=p.stephenson@samsung.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).