Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: 5.4.1 regression: PCRE with bash_rematch



On 2017-08-13 at 16:49 -0400, Phil Pennock wrote:
> I'm still trying to track this down, but getting what I have out there
> because in checking just now, I saw that a 5.4.2 might be imminent and I
> think this should block.

Definitely; this is a regression from my NUL fixing and trying to
correctly meta/unmeta all parameters going through.  Change 41308 in
commit 825f84c77 exposed a bug introduced in 2011 in commit 2f3c16d40f.

> % /opt/zsh-devel/bin/zsh -f
> osmium% setopt bash_rematch
> osmium% zmodload zsh/pcre
> osmium% [[ "server" -pcre-match ^[^@:/]+$ ]]

186         if (!want_begin_end || nelem) {
187             char **x, **y;
188             int vec_off;
189             y = &captures[capture_start];
190             matches = x = (char **) zalloc(sizeof(char *) * (arrlen(y) + 1));
191             vec_off = 2;
192             do {
193                 if (*y)
194                     *x++ = metafy(*y, ovec[vec_off+1]-ovec[vec_off], META_DUP);
195                 else
196                     *x++ = NULL;
197                 vec_off += 2;
198             } while (*y++);
199             setaparam(substravar, matches);
200         }

We hit problems in line 194, we're capturing for sub-expressions, but
there are no sub-expressions.  We have a regexp with no sub-captures but
through the bash_rematch path we're hitting this which assumes that we
are.



Messages sorted by: Reverse Date, Date, Thread, Author