summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--Src/lex.c13
-rw-r--r--Test/D04parameter.ztst8
3 files changed, 24 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index a5ac3713e..3ed655135 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2016-11-03 Peter Stephenson <p.stephenson@samsung.com>
+
+ * 39815: Src/lex.c, Test/D04parameter.ztst: read input to end
+ on parse error in $(...) inside a string.
+
2016-11-02 Barton E. Schaefer <schaefer@zsh.org>
* 39811: Src/Zle/zle_vi.c: vi-repeat-change must not be the
diff --git a/Src/lex.c b/Src/lex.c
index e0935bf05..889612825 100644
--- a/Src/lex.c
+++ b/Src/lex.c
@@ -2138,8 +2138,17 @@ skipcomm(void)
lexflags &= ~LEXFLAGS_ZLE;
dbparens = 0; /* restored by zcontext_restore_partial() */
- if (!parse_event(OUTPAR) || tok != OUTPAR)
- lexstop = 1;
+ if (!parse_event(OUTPAR) || tok != OUTPAR) {
+ if (strin) {
+ /*
+ * Get the rest of the string raw since we don't
+ * know where this token ends.
+ */
+ while (!lexstop)
+ (void)ingetc();
+ } else
+ lexstop = 1;
+ }
/* Outpar lexical token gets added in caller if present */
/*
diff --git a/Test/D04parameter.ztst b/Test/D04parameter.ztst
index 762305197..97c8ba3fc 100644
--- a/Test/D04parameter.ztst
+++ b/Test/D04parameter.ztst
@@ -631,6 +631,14 @@
>;
>(( echo 42
+ # From parse error on it's not possible to split.
+ # Just check we get the complete string.
+ foo='echo $(|||) bar'
+ print -rl ${(z)foo}
+0:$($(z)} with parse error in command substitution.
+>echo
+>$(|||) bar
+
psvar=(dog)
setopt promptsubst
foo='It shouldn'\''t $(happen) to a %1v.'