Bug 767240 - Regex failures with pcre 8.38
Regex failures with pcre 8.38
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: gregex
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
:
Depends on:
Blocks:
  Show dependency tree
 
Reported: 2016-06-04 14:19 UTC by Krzesimir Nowak
Modified: 2016-08-16 08:42 UTC (History)
1 user (show)

See Also:
GNOME target: ---
GNOME version: ---


Attachments
gregex: loosen behaviour testing (2.70 KB, patch)
2016-08-09 10:50 UTC, Allison Lortie (desrt) (extended vacation)
committed Details | Diff | Review

Description Krzesimir Nowak 2016-06-04 14:19:11 UTC
I'm getting an error on make check - ERROR:regex.c:82:test_new: assertion failed (g_regex_get_compile_flags (regex) == data->real_compile_opts): (0x00000000 == 0x00000001)

Looks like some options passed at the beginning of the regex pattern ("(?stuff)") are ignored.

The following tests are failing.

  TEST_NEW_CHECK_FLAGS ("(?i)a", 0, 0, G_REGEX_CASELESS, 0);
  TEST_NEW_CHECK_FLAGS ("(?m)a", 0, 0, G_REGEX_MULTILINE, 0);
  TEST_NEW_CHECK_FLAGS ("(?s)a", 0, 0, G_REGEX_DOTALL, 0);
  TEST_NEW_CHECK_FLAGS ("(?x)a", 0, 0, G_REGEX_EXTENDED, 0);
  TEST_NEW_CHECK_FLAGS ("(?U)[a-z]+", 0, 0, G_REGEX_UNGREEDY, 0);

This is using pcre on fedora 24.
Comment 1 Allison Lortie (desrt) (extended vacation) 2016-08-09 10:14:49 UTC
The options are definitely not being ignored.  pcre just stopped reporting them via the pcre_fullinfo() API.
Comment 2 Allison Lortie (desrt) (extended vacation) 2016-08-09 10:34:08 UTC
This broke here, apparently somewhat intentionally:

http://vcs.pcre.org/pcre/code/trunk/pcre_compile.c?r1=1616&r2=1617
Comment 3 Allison Lortie (desrt) (extended vacation) 2016-08-09 10:35:50 UTC
imho, it's not really important that we report these options on the public API, and I don't see a good way of doing it with the currently-released PCRE.  I think the correct fix here is a documentation tweak and removal of these testcases.
Comment 4 Allison Lortie (desrt) (extended vacation) 2016-08-09 10:50:42 UTC
Created attachment 332992 [details] [review]
gregex: loosen behaviour testing

Circa 8.38, upstream PCRE (intentionally?) changed behaviour with
respect to whether options set with expressions like "(?i)" at the
top-level were reported via the pcre_fullinfo() API as having been
requested during compilation.

GLib contained a test that verified that these options were indeed
reported as if they had been provided as flags on the API.

Remove that check, and document the no-longer-deterministic behaviour.
Comment 5 Krzesimir Nowak 2016-08-09 15:53:38 UTC
The patch looks good to me, we don't have much choice to avoid the breakage if somebody relied these flags to be reported.
Comment 6 Allison Lortie (desrt) (extended vacation) 2016-08-16 08:42:24 UTC
Pushed.

Note You need to log in before you can comment on or make changes to this bug.