From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from primenet.com.au (ns1.primenet.com.au [203.24.36.2]) by inbox.vuxu.org (OpenSMTPD) with ESMTP id bf01d5d7 for ; Wed, 1 Jan 2020 14:08:16 +0000 (UTC) Received: (qmail 1162 invoked by alias); 1 Jan 2020 14:08:12 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: List-Unsubscribe: X-Seq: 45181 Received: (qmail 9350 invoked by uid 1010); 1 Jan 2020 14:08:12 -0000 X-Qmail-Scanner-Diagnostics: from wout3-smtp.messagingengine.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.102.1/25677. spamassassin: 3.4.2. Clear:RC:0(64.147.123.19):SA:0(-1.9/5.0):. Processed in 2.594 secs); 01 Jan 2020 14:08:12 -0000 X-Envelope-From: danielsh@apache.org X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: softfail (ns1.primenet.com.au: transitioning SPF record at amazonses.com does not designate 64.147.123.19 as permitted sender) X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedufedrvdefledgiedtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvffufffkofestddtredtredttd enucfhrhhomhepffgrnhhivghlucfuhhgrhhgrfhcuoegurghnihgvlhhshhesrghprggt hhgvrdhorhhgqeenucffohhmrghinheprghushhtihhnghhrohhuphgsuhhgshdrnhgvth enucfkphepjeelrddukedtrdehjedrudduleenucfrrghrrghmpehmrghilhhfrhhomhep uggrnhhivghlshhhsegrphgrtghhvgdrohhrghenucevlhhushhtvghrufhiiigvpedt X-ME-Proxy: From: Daniel Shahaf 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 Message-Id: <20200101140731.9125-1-danielsh@apache.org> X-Mailer: git-send-email 2.11.0 --- 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