retitle 755439 pcre3: DFA matching behaviour changed, breaking glib2.0 tests
reassign 755439 libpcre3,glib2.0
found 755439 pcre3/8.35-2,glib2.0/2.40.0-3
forwarded 755439 
http://bugs.exim.org/show_bug.cgi?id=1504,https://bugzilla.gnome.org/show_bug.cgi?id=733325
severity 755439 serious
thanks

On Sun, 20 Jul 2014 at 20:42:05 +0100, Simon McVittie wrote:
> The GLib tests are going to fail with PCRE 8.35, see referenced
> upstream bug. Some of the failures are clearly spurious and can be
> patched out, but some look like a genuine bug, either in GLib or PCRE
> (my guess would be PCRE but I'm not sure).

The remaining failures seem to be an intentional behaviour change in PCRE.
I don't know whether the correct resolution is "adapt GLib" or "partially
revert the change in PCRE" so I'm assigning this bug to both for now.

> This should maybe be Severity: serious

The regex test reliably fails, which will already cause FTBFS in glib2.0
if it is rebuilt in today's amd64 unstable, so yes I think it should.

> but it'd probably be better with a test case that only uses PCRE API
> first

Attached, and also sent upstream to the PCRE and GLib bug-trackers.

I have also sent potential fixes for GLib upstream to the GLib bug-tracker,
but I'm not going to copy them to this bug until there's some sort of
consensus how many of these issues are GLib bugs and how many are PCRE bugs.

    S
/* gcc -odfa -lpcre dfa.c */

#include <assert.h>

#include <pcre.h>

int
main (void)
{
  int errcode;
  const char *errmsg;
  int erroffset;
  pcre *re;
  int done;
  int matches;
  /* should be plenty */
  int n_offsets = 1024;
  int offsets[1024] = { 0 };
  int n_workspace = 1024;
  int workspace[1024] = { 0 };

  re = pcre_compile2 ("a+", 0, &errcode, &errmsg, &erroffset, NULL);
  assert (re != NULL);

  matches = pcre_dfa_exec (re, NULL,
      "aaa", 3, 0, 0, offsets, n_offsets,
      workspace, n_workspace);

  assert (matches != PCRE_ERROR_DFA_WSSIZE);
  assert (matches != 0);
  assert (matches >= PCRE_ERROR_NOMATCH || matches == PCRE_ERROR_PARTIAL);

  assert (offsets[0] == 0);
  assert (offsets[1] == 3);
  assert (offsets[2] == 0);
  assert (offsets[3] == 2);
  assert (offsets[4] == 0);
  assert (offsets[5] == 1);
  assert (matches == 3);

  return 0;
}

Reply via email to