zsh-workers
 help / color / mirror / code / Atom feed
From: Daniel Shahaf <danielsh@apache.org>
To: zsh-workers@zsh.org
Subject: [PATCH] Fix workers/45164: ${(S)%%} will now consider the empty string as a potential match.
Date: Wed,  1 Jan 2020 14:07:31 +0000	[thread overview]
Message-ID: <20200101140731.9125-1-danielsh@apache.org> (raw)

---
 Src/glob.c             | 4 ++--
 Test/D04parameter.ztst | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/Src/glob.c b/Src/glob.c
index ca5846704..f67a376b9 100644
--- a/Src/glob.c
+++ b/Src/glob.c
@@ -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);
diff --git a/Test/D04parameter.ztst b/Test/D04parameter.ztst
index f4af5d59c..83ac7ebf4 100644
--- a/Test/D04parameter.ztst
+++ b/Test/D04parameter.ztst
@@ -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

                 reply	other threads:[~2020-01-01 14:08 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200101140731.9125-1-danielsh@apache.org \
    --to=danielsh@apache.org \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).