From e44600d9aac905aea08050c7387d6effd52c8539 Mon Sep 17 00:00:00 2001
From: Peter Stephenson
Date: Sun, 10 Sep 2017 18:01:39 +0100
Subject: 41661: Need to remove tokens before using bufferwords() for (z)
---
Src/subst.c | 8 ++++++--
Test/D04parameter.ztst | 7 +++++++
2 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/Src/subst.c b/Src/subst.c
index 5b1bf8988..5df2a8b2d 100644
--- a/Src/subst.c
+++ b/Src/subst.c
@@ -3747,11 +3747,15 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int pf_flags,
if (isarr) {
char **ap;
- for (ap = aval; *ap; ap++)
+ for (ap = aval; *ap; ap++) {
+ untokenize(*ap);
list = bufferwords(list, *ap, NULL, shsplit);
+ }
isarr = 0;
- } else
+ } else {
+ untokenize(val);
list = bufferwords(NULL, val, NULL, shsplit);
+ }
if (!list || !firstnode(list))
val = dupstring("");
diff --git a/Test/D04parameter.ztst b/Test/D04parameter.ztst
index 3c93990f1..8dbc1e8b8 100644
--- a/Test/D04parameter.ztst
+++ b/Test/D04parameter.ztst
@@ -2200,3 +2200,10 @@ F:behavior, see http://austingroupbugs.net/view.php?id=888
>Option
>Regular text
>Option
+
+ (setopt nonomatch
+ print ${(z):-foo-bar*thingy?}
+ )
+0:(z) splitting with remaining tokens
+>foo-bar*thingy?
+
--
cgit 1.4.1