Control: tags 834272 + patch
Control: forwarded 834272 https://bugzilla.gnome.org/show_bug.cgi?id=767240
On Sun, 14 Aug 2016 at 02:21:40 +0200, Santiago Vila wrote:
> ERROR:/build/glib2.0-2.48.1/./glib/tests/regex.c:82:test_new: assertion
> failed (g_regex_get_compile_flags (regex) == data->real_compile_opts):
> (0x00000000 == 0x00000001)
This is caused by a PCRE behaviour change - as usual, GLib's GRegex
tests find PCRE behaviour changes more readily than PCRE's. Allison
Lortie proposed a patch upstream, although it hasn't been applied yet.
Testing that patch in the Debian package now.
S
From: Allison Lortie <[email protected]>
Date: Tue, 9 Aug 2016 12:46:30 +0200
Subject: 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.
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=767240
Applied-upstream: no
---
glib/gregex.c | 4 ++++
glib/tests/regex.c | 13 ++++++-------
2 files changed, 10 insertions(+), 7 deletions(-)
diff --git a/glib/gregex.c b/glib/gregex.c
index 325f8d2..0cfe639 100644
--- a/glib/gregex.c
+++ b/glib/gregex.c
@@ -1582,6 +1582,10 @@ g_regex_get_max_lookbehind (const GRegex *regex)
*
* Returns the compile options that @regex was created with.
*
+ * Depending on the version of PCRE that is used, this may or may not
+ * include flags set by option expressions such as `(?i)` found at the
+ * top-level within the compiled pattern.
+ *
* Returns: flags from #GRegexCompileFlags
*
* Since: 2.26
diff --git a/glib/tests/regex.c b/glib/tests/regex.c
index bd42230..a597214 100644
--- a/glib/tests/regex.c
+++ b/glib/tests/regex.c
@@ -2218,17 +2218,16 @@ main (int argc, char *argv[])
TEST_NEW("(?P<A>x)|(?P<A>y)", G_REGEX_DUPNAMES | G_REGEX_OPTIMIZE, 0);
/* This gives "internal error: code overflow" with pcre 6.0 */
TEST_NEW("(?i)(?-i)", 0, 0);
+ TEST_NEW ("(?i)a", 0, 0);
+ TEST_NEW ("(?m)a", 0, 0);
+ TEST_NEW ("(?s)a", 0, 0);
+ TEST_NEW ("(?x)a", 0, 0);
+ TEST_NEW ("(?J)a", 0, 0);
+ TEST_NEW ("(?U)[a-z]+", 0, 0);
- /* Check that flags are correct if the pattern modifies them */
/* TEST_NEW_CHECK_FLAGS(pattern, compile_opts, match_ops, real_compile_opts, real_match_opts) */
TEST_NEW_CHECK_FLAGS ("a", G_REGEX_OPTIMIZE, 0, G_REGEX_OPTIMIZE, 0);
TEST_NEW_CHECK_FLAGS ("a", G_REGEX_RAW, 0, G_REGEX_RAW, 0);
- 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 ("(?J)a", 0, 0, G_REGEX_DUPNAMES, 0);
- TEST_NEW_CHECK_FLAGS ("(?U)[a-z]+", 0, 0, G_REGEX_UNGREEDY, 0);
TEST_NEW_CHECK_FLAGS ("(?X)a", 0, 0, 0 /* not exposed by GRegex */, 0);
TEST_NEW_CHECK_FLAGS ("^.*", 0, 0, G_REGEX_ANCHORED, 0);
TEST_NEW_CHECK_FLAGS ("(*UTF8)a", 0, 0, 0 /* this is the default in GRegex */, 0);