zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <p.stephenson@samsung.com>
To: zsh-workers@zsh.org
Subject: Re: Strange behavior of [[
Date: Mon, 22 Jun 2015 17:29:09 +0100	[thread overview]
Message-ID: <20150622172909.2549fb29@pwslap01u.europe.root.pri> (raw)
In-Reply-To: <55883016.1080103@googlemail.com>

On Mon, 22 Jun 2015 17:56:06 +0200
m0viefreak <m0viefreak.cm@googlemail.com> wrote:
> On 11.06.2015 18:59, Peter Stephenson wrote:
> > The change from mb_metacharinit() to mb_charinit() is a bit unsightly
> > but the name had got just plain confusing --- there's nothing meta about
> > it.  I never metacharacter I couldn't parse.
> > 
> > (No multibyte characters were harmed in the preparation of this email;
> > I've used $'\ua0'.)
> > 
> > pws
> > 
> > <path diff>
> > ...
> > </path diff>
> 
> This patch (f1923bdfa6300a0d32e3329eb2488447f76b8970) introduces another
> issue for me:
> 
> Regex evaluation using a conditional capture group crashes zsh when the
> pattern is not found:

This isn't fundamentally new, it's just a different response to an
unhandled condition.

-1 is consistent with what glob matches do.

pws

diff --git a/Src/Modules/regex.c b/Src/Modules/regex.c
index 94f523f..16cc77f 100644
--- a/Src/Modules/regex.c
+++ b/Src/Modules/regex.c
@@ -155,6 +155,11 @@ zcond_regex_match(char **a, int id)
 			 ++n, ++m, ++bptr, ++eptr)
 		    {
 			char buf[DIGBUFSIZE];
+			if (m->rm_so < 0 || m->rm_eo < 0) {
+			    *bptr = ztrdup("-1");
+			    *eptr = ztrdup("-1");
+			    continue;
+			}
 			ptr = lhstr;
 			leftlen = m->rm_so;
 			offs = 0;


  reply	other threads:[~2015-06-22 16:29 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-10  3:27 Maxime Arthaud
2015-06-10  5:31 ` Bart Schaefer
2015-06-10  8:55   ` Peter Stephenson
2015-06-11 16:59     ` Peter Stephenson
2015-06-22 15:56       ` m0viefreak
2015-06-22 16:29         ` Peter Stephenson [this message]
2016-01-08 13:09 ` Jun T.
2016-04-23  9:51   ` Segfault with PCRE (Re: Strange behavior of [[) Mikael Berthe
2016-04-23 21:22     ` Bart Schaefer

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=20150622172909.2549fb29@pwslap01u.europe.root.pri \
    --to=p.stephenson@samsung.com \
    --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).