diff options
author | Jeremy Harris <jgh146exb@wizmail.org> | 2020-05-25 11:38:25 +0100 |
---|---|---|
committer | Jeremy Harris <jgh146exb@wizmail.org> | 2020-05-25 21:05:55 +0100 |
commit | 43ac2ce5e55c134367e7a6c8eb8d2129df00c770 (patch) | |
tree | feed67a87688b69e292c46c967c2ce9ea911af6d | |
parent | c21235119a8ab47a55abcf94a83aace510edf5d7 (diff) |
Fix listquote expansion item to handle empty-string input
-rw-r--r-- | src/src/expand.c | 3 | ||||
-rw-r--r-- | test/scripts/0000-Basic/0002 | 1 | ||||
-rw-r--r-- | test/stdout/0002 | 1 |
3 files changed, 4 insertions, 1 deletions
diff --git a/src/src/expand.c b/src/src/expand.c index 7c9d48100..2c29c26d5 100644 --- a/src/src/expand.c +++ b/src/src/expand.c @@ -6186,11 +6186,12 @@ while (*s != 0) case 2: case 3: goto EXPAND_FAILED; } - for (uschar sep = *sub[0], c; c = *sub[1]; sub[1]++) + if (*sub[1]) for (uschar sep = *sub[0], c; c = *sub[1]; sub[1]++) { if (c == sep) yield = string_catn(yield, sub[1], 1); yield = string_catn(yield, sub[1], 1); } + else yield = string_catn(yield, US" ", 1); continue; } diff --git a/test/scripts/0000-Basic/0002 b/test/scripts/0000-Basic/0002 index db8d70981..a8fc0bcb2 100644 --- a/test/scripts/0000-Basic/0002 +++ b/test/scripts/0000-Basic/0002 @@ -133,6 +133,7 @@ listquote: ${listquote{:}{ab::cd}} listquote: ${listquote{;}{ab:cd}} listquote: ${listquote{;}{ab;cd}} listquote: ${listquote{ }{ ab cd}} +listquote: <${listquote{:}{}}> sort: ${sort{3:2:1:4}{<}{$item}} sort: ${sort {<, 3,2,1,4}{>}{$item}} diff --git a/test/stdout/0002 b/test/stdout/0002 index ea918aebb..b8ff36122 100644 --- a/test/stdout/0002 +++ b/test/stdout/0002 @@ -122,6 +122,7 @@ > listquote: ab:cd > listquote: ab;;cd > listquote: ab cd +> listquote: < > > > sort: 1:2:3:4 > sort: 4,3,2,1 |