Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

PATCH: Better handling for (yet another) command substitution failure



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';
 



Messages sorted by: Reverse Date, Date, Thread, Author