45181: Fix workers/45164: ${(S)%%} will now consider the empty string as a potential match.

This commit is contained in:
Daniel Shahaf 2019-12-31 18:07:02 +00:00
parent da19b67388
commit b591d43113
3 changed files with 8 additions and 3 deletions

View file

@ -1,3 +1,8 @@
2020-01-02 Daniel Shahaf <danielsh@apache.org>
* 45181: Src/glob.c, Test/D04parameter.ztst: Fix workers/45164:
${(S)%%} will now consider the empty string as a potential match.
2020-01-01 dana <dana@dana.is>
* Stephane: 45183: Doc/Zsh/builtins.yo, Doc/Zsh/contrib.yo,

View file

@ -3059,7 +3059,7 @@ igetmatch(char **sp, Patprog p, int fl, int n, char *replstr,
case (SUB_END|SUB_SUBSTR):
case (SUB_END|SUB_LONG|SUB_SUBSTR):
/* Longest/shortest at end, matching substrings. */
if (!(fl & SUB_LONG)) {
{
set_pat_start(p, l);
if (pattrylen(p, send, 0, 0, &patstralloc, umltot) &&
!--n) {
@ -3397,7 +3397,7 @@ igetmatch(char **sp, Patprog p, int fl, int n, char *replstr,
case (SUB_END|SUB_SUBSTR):
case (SUB_END|SUB_LONG|SUB_SUBSTR):
/* Longest/shortest at end, matching substrings. */
if (!(fl & SUB_LONG)) {
{
set_pat_start(p, l);
if (pattrylen(p, send, 0, 0, &patstralloc, uml) && !--n) {
*sp = get_match_ret(&imd, uml, uml);

View file

@ -2639,7 +2639,7 @@ F:behavior, see http://austingroupbugs.net/view.php?id=888
foo=pws
print 2: ${(S)foo%%*}
-f:(S) with zero-length matches at end, part 1 (workers/45164)
0:(S) with zero-length matches at end, part 1 (workers/45164)
>2: pws
foo=pws