From d6b027c3c1203da5f3c6451bd6e2e0b81bd766b6 Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Mon, 6 Feb 2023 14:16:17 +0000 Subject: 51350: ${(S)...//#%...} didn't match the whole string --- ChangeLog | 5 +++++ Src/subst.c | 3 +++ Test/D04parameter.ztst | 7 +++++++ 3 files changed, 15 insertions(+) diff --git a/ChangeLog b/ChangeLog index 1a66e94e9..2e63157de 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2023-02-06 Peter Stephenson + + * 51350: Src/subst.c, Test/D04parameter.ztst: the combination + ${(S)...//#%...} needs to match as far as possible. + 2023-02-02 Daniel Shahaf * 51354: Doc/Zsh/params.yo: Fix markup in man page version diff --git a/Src/subst.c b/Src/subst.c index 4ad9fee1a..3dd920e87 100644 --- a/Src/subst.c +++ b/Src/subst.c @@ -2926,6 +2926,9 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int pf_flags, */ if (!(flags & (SUB_MATCH|SUB_REST|SUB_BIND|SUB_EIND|SUB_LEN))) flags |= SUB_REST; + /* If matching at start and end, don't stop early */ + if ((flags & (SUB_START|SUB_END)) == (SUB_START|SUB_END)) + flags |= SUB_LONG; /* * With ":" treat a value as unset if the variable is set but diff --git a/Test/D04parameter.ztst b/Test/D04parameter.ztst index a11652d1e..7990c2958 100644 --- a/Test/D04parameter.ztst +++ b/Test/D04parameter.ztst @@ -2307,6 +2307,13 @@ F:behavior, see http://austingroupbugs.net/view.php?id=888 >x >y + a="string" + print ${(S)a//#%((#b)(*))/different} + print $match[1] +0:Fully anchored string must be fully searched +>different +>string + my_width=6 my_index=1 my_options=Option1 -- cgit 1.4.1