zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <p.stephenson@samsung.com>
To: Zsh Hackers' List <zsh-workers@zsh.org>
Subject: PATCH: Better handling for (yet another) command substitution failure
Date: Thu, 19 Feb 2015 11:40:31 +0000	[thread overview]
Message-ID: <20150219114031.665995c5@pwslap01u.europe.root.pri> (raw)

Entirely coincidentally (the problem isn't new and the fact that I'm
adding another error message exactly parallel to the one I added two
hours ago is just plain weird) another problem with command substitution
just turned up.  This handles the error case it's hitting better.  I
still need to look and see if it should be even getting here, and if it
shouldn't I'll fix that and add a corresponding test, but a hard error
at this point is much safer.

Also fix the capitalization convention for errors...

pws

diff --git a/Src/subst.c b/Src/subst.c
index 056b12b..176a004 100644
--- a/Src/subst.c
+++ b/Src/subst.c
@@ -264,7 +264,7 @@ stringsubst(LinkList list, LinkNode node, int pf_flags, int asssub)
 		while (*str != Outparmath && *str)
 		    str++;
 		if (*str != Outparmath) {
-		    zerr("Failed to find end of math substitution");
+		    zerr("failed to find end of math substitution");
 		    return NULL;
 		}
 		str[-1] = '\0';
@@ -278,8 +278,12 @@ stringsubst(LinkList list, LinkNode node, int pf_flags, int asssub)
 		endchar = c;
 		*str = '\0';
 
-		while (*++str != endchar)
-		    DPUTS(!*str, "BUG: parse error in command substitution");
+		while (*++str != endchar) {
+		    if (!*str) {
+			zerr("failed to find end of command substitution");
+			return NULL;
+		    }
+		}
 	    }
 	    *str++ = '\0';
 


             reply	other threads:[~2015-02-19 11:50 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-19 11:40 Peter Stephenson [this message]
2015-02-20 15:40 ` Peter Stephenson

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=20150219114031.665995c5@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).