summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog10
-rw-r--r--Src/lex.c14
-rw-r--r--Test/D04parameter.ztst21
3 files changed, 41 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 8feffbf1d..c5ebfa389 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2017-10-17 Barton E. Schaefer <schaefer@zsh.org>
+
+ * unposted: Test/D04parameter.ztst: tests for 41902
+
+ * 41902: Src/lex.c: ${(z)...} continues parsing on unmatched
+ quote when CSH_JUNKIE_QUOTES is set.
+
+ * unposted (cf. Sebastian: 41891): Test/D04parameter.ztst:
+ regression test for 41873
+
2017-10-17 Daniel Shahaf <d.s@daniel.shahaf.name>
* unposted: Doc/Zsh/builtins.yo: Document "typeset -p"'s optional
diff --git a/Src/lex.c b/Src/lex.c
index e0190afc6..c2a59661c 100644
--- a/Src/lex.c
+++ b/Src/lex.c
@@ -1291,7 +1291,9 @@ gettokstr(int c, int sub)
ALLOWHIST
if (c != '\'') {
unmatched = '\'';
- peek = LEXERR;
+ /* Not an error when called from bufferwords() */
+ if (!(lexflags & LEXFLAGS_ACTIVE))
+ peek = LEXERR;
cmdpop();
goto brk;
}
@@ -1313,7 +1315,9 @@ gettokstr(int c, int sub)
cmdpop();
if (c) {
unmatched = '"';
- peek = LEXERR;
+ /* Not an error when called from bufferwords() */
+ if (!(lexflags & LEXFLAGS_ACTIVE))
+ peek = LEXERR;
goto brk;
}
c = Dnull;
@@ -1350,7 +1354,9 @@ gettokstr(int c, int sub)
cmdpop();
if (c != '`') {
unmatched = '`';
- peek = LEXERR;
+ /* Not an error when called from bufferwords() */
+ if (!(lexflags & LEXFLAGS_ACTIVE))
+ peek = LEXERR;
goto brk;
}
c = Tick;
@@ -1392,7 +1398,7 @@ gettokstr(int c, int sub)
return LEXERR;
}
hungetc(c);
- if (unmatched)
+ if (unmatched && !(lexflags & LEXFLAGS_ACTIVE))
zerr("unmatched %c", unmatched);
if (in_brace_param) {
while(bct-- >= in_brace_param)
diff --git a/Test/D04parameter.ztst b/Test/D04parameter.ztst
index 5ffaaa126..3b187f492 100644
--- a/Test/D04parameter.ztst
+++ b/Test/D04parameter.ztst
@@ -2401,3 +2401,24 @@ F:behavior, see http://austingroupbugs.net/view.php?id=888
0:Append to element of associative array on creation
>one
>howsyourfathertoday
+
+ local b=$'a+=(${(o)$(ls -1 \'.*\' | perl -alne \'\nEND{ print " "; }\'\n)})'
+ printf ': %s\n' "${(@Z+cn+)b}"
+0:(Z) flag splitting with $( closed after embedded newline
+>: a+=(
+>: ${(o)$(ls -1 '.*' | perl -alne '
+>END{ print " "; }'
+>)}
+>: )
+
+ local b=$'# \' single\n# \" double\n# ` backtick\nword'
+ (setopt CSH_JUNKIE_QUOTES
+ printf ': %s\n' "${(@Z+n+)b}")
+0:(z) flag with CSH_JUNKIE_QUOTES
+>: #
+>: ' single
+>: #
+>: " double
+>: #
+>: ` backtick
+>: word