r42134 - in /desktop/unstable/glib2.0/debian: ./ patches/

smcv at users.alioth.debian.org smcv at users.alioth.debian.org
Mon Aug 4 09:48:37 UTC 2014


Author: smcv
Date: Mon Aug  4 09:48:36 2014
New Revision: 42134

URL: http://svn.debian.org/wsvn/pkg-gnome/?sc=1&rev=42134
Log:
* Adapt for system pcre3/1:8.35 (Closes: #755439):
  - a PCRE 8.31 bug in case-insensitivity has been fixed, so do not assert
    bug-for-bug compatibility with 8.31
  - named match groups' names cannot start with a digit any more, so
    (?P<1>.) is no longer allowed; do not assert that it is
  - turn off a new optimization that would reduce the result set when called
    from g_match_all(_full), to preserve existing functionality
* Build-depend on pcre3/1:8.35 so that the new optimization is
  known to be turned off in the built binaries
* Add patch from upstream to fix mis-optimization in gvariant test
  with gcc 4.9 (Closes: #756272)

Added:
    desktop/unstable/glib2.0/debian/patches/gvariant-tests-workaround-libc-compiler-issue.patch
    desktop/unstable/glib2.0/debian/patches/regex-if-PCRE-is-8.34-or-later-disable-auto-possessi.patch
    desktop/unstable/glib2.0/debian/patches/regex-test-do-not-assert-that-system-PCRE-allows-P-1.patch
    desktop/unstable/glib2.0/debian/patches/regex-test-do-not-assert-that-system-PCRE-still-has-.patch
Modified:
    desktop/unstable/glib2.0/debian/changelog
    desktop/unstable/glib2.0/debian/control
    desktop/unstable/glib2.0/debian/control.in
    desktop/unstable/glib2.0/debian/patches/series

Modified: desktop/unstable/glib2.0/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-gnome/desktop/unstable/glib2.0/debian/changelog?rev=42134&op=diff
==============================================================================
--- desktop/unstable/glib2.0/debian/changelog	[utf-8] (original)
+++ desktop/unstable/glib2.0/debian/changelog	[utf-8] Mon Aug  4 09:48:36 2014
@@ -12,6 +12,19 @@
   [ Emilio Pozuelo Monfort ]
   * Use the default compiler on sparc, since it's already >> 4.7.
     Closes: #751313.
+
+  [ Simon McVittie ]
+  * Adapt for system pcre3/1:8.35 (Closes: #755439):
+    - a PCRE 8.31 bug in case-insensitivity has been fixed, so do not assert
+      bug-for-bug compatibility with 8.31
+    - named match groups' names cannot start with a digit any more, so
+      (?P<1>.) is no longer allowed; do not assert that it is
+    - turn off a new optimization that would reduce the result set when called
+      from g_match_all(_full), to preserve existing functionality
+  * Build-depend on pcre3/1:8.35 so that the new optimization is
+    known to be turned off in the built binaries
+  * Add patch from upstream to fix mis-optimization in gvariant test
+    with gcc 4.9 (Closes: #756272)
 
  -- Emilio Pozuelo Monfort <pochu at debian.org>  Mon, 05 May 2014 11:50:10 +0200
 

Modified: desktop/unstable/glib2.0/debian/control
URL: http://svn.debian.org/wsvn/pkg-gnome/desktop/unstable/glib2.0/debian/control?rev=42134&op=diff
==============================================================================
--- desktop/unstable/glib2.0/debian/control	[utf-8] (original)
+++ desktop/unstable/glib2.0/debian/control	[utf-8] Mon Aug  4 09:48:36 2014
@@ -12,7 +12,7 @@
                gnome-pkg-tools (>= 0.11),
                dpkg-dev (>= 1.16.0),
                libelfg0-dev (>= 0.8.12),
-               libpcre3-dev (>= 1:8.31),
+               libpcre3-dev (>= 1:8.35),
                desktop-file-utils,
                gtk-doc-tools (>= 1.20),
                libselinux1-dev [linux-any],

Modified: desktop/unstable/glib2.0/debian/control.in
URL: http://svn.debian.org/wsvn/pkg-gnome/desktop/unstable/glib2.0/debian/control.in?rev=42134&op=diff
==============================================================================
--- desktop/unstable/glib2.0/debian/control.in	[utf-8] (original)
+++ desktop/unstable/glib2.0/debian/control.in	[utf-8] Mon Aug  4 09:48:36 2014
@@ -12,7 +12,7 @@
                gnome-pkg-tools (>= 0.11),
                dpkg-dev (>= 1.16.0),
                libelfg0-dev (>= 0.8.12),
-               libpcre3-dev (>= 1:8.31),
+               libpcre3-dev (>= 1:8.35),
                desktop-file-utils,
                gtk-doc-tools (>= 1.20),
                libselinux1-dev [linux-any],

Added: desktop/unstable/glib2.0/debian/patches/gvariant-tests-workaround-libc-compiler-issue.patch
URL: http://svn.debian.org/wsvn/pkg-gnome/desktop/unstable/glib2.0/debian/patches/gvariant-tests-workaround-libc-compiler-issue.patch?rev=42134&op=file
==============================================================================
--- desktop/unstable/glib2.0/debian/patches/gvariant-tests-workaround-libc-compiler-issue.patch	(added)
+++ desktop/unstable/glib2.0/debian/patches/gvariant-tests-workaround-libc-compiler-issue.patch	[utf-8] Mon Aug  4 09:48:36 2014
@@ -0,0 +1,63 @@
+From: Ryan Lortie <desrt at desrt.ca>
+Date: Tue, 24 Jun 2014 10:40:30 -0400
+Subject: gvariant tests: workaround libc/compiler "issue"
+
+memcmp() is declared by glibc as follows:
+
+  /* Compare N bytes of S1 and S2.  */
+  extern int memcmp (const void *__s1, const void *__s2, size_t __n)
+       __THROW __attribute_pure__ __nonnull ((1, 2));
+
+despite the fact that it is valid to call it with a null pointer if the
+size is zero.
+
+gcc 4.9.0 contains a new optimisation that sees that we pass a pointer
+to this function and concludes that it certainly must not be null,
+removing a later check and thereby causing a crash.
+
+We protect the invocation of memcmp() with a condition to prevent gcc
+from making this false assumption (arguably under wrong advice from
+glibc).
+
+Origin: upstream, 2.41.2, commit:f727c820b823178285d90b3f033f7d2a4d3cdf9f
+---
+ glib/tests/gvariant.c | 12 +++++++++---
+ 1 file changed, 9 insertions(+), 3 deletions(-)
+
+diff --git a/glib/tests/gvariant.c b/glib/tests/gvariant.c
+index 122400e..9152a43 100644
+--- a/glib/tests/gvariant.c
++++ b/glib/tests/gvariant.c
+@@ -1520,7 +1520,9 @@ test_array (void)
+         g_variant_serialiser_serialise (serialised, random_instance_filler,
+                                         (gpointer *) instances, n_children);
+ 
+-        g_assert (memcmp (serialised.data, data, serialised.size) == 0);
++        if (serialised.size)
++          g_assert (memcmp (serialised.data, data, serialised.size) == 0);
++
+         g_assert (g_variant_serialised_n_children (serialised) == n_children);
+ 
+         for (i = 0; i < n_children; i++)
+@@ -1681,7 +1683,9 @@ test_tuple (void)
+         g_variant_serialiser_serialise (serialised, random_instance_filler,
+                                         (gpointer *) instances, n_children);
+ 
+-        g_assert (memcmp (serialised.data, data, serialised.size) == 0);
++        if (serialised.size)
++          g_assert (memcmp (serialised.data, data, serialised.size) == 0);
++
+         g_assert (g_variant_serialised_n_children (serialised) == n_children);
+ 
+         for (i = 0; i < n_children; i++)
+@@ -1774,7 +1778,9 @@ test_variant (void)
+         g_variant_serialiser_serialise (serialised, random_instance_filler,
+                                         (gpointer *) &instance, 1);
+ 
+-        g_assert (memcmp (serialised.data, data, serialised.size) == 0);
++        if (serialised.size)
++          g_assert (memcmp (serialised.data, data, serialised.size) == 0);
++
+         g_assert (g_variant_serialised_n_children (serialised) == 1);
+ 
+         child = g_variant_serialised_get_child (serialised, 0);

Added: desktop/unstable/glib2.0/debian/patches/regex-if-PCRE-is-8.34-or-later-disable-auto-possessi.patch
URL: http://svn.debian.org/wsvn/pkg-gnome/desktop/unstable/glib2.0/debian/patches/regex-if-PCRE-is-8.34-or-later-disable-auto-possessi.patch?rev=42134&op=file
==============================================================================
--- desktop/unstable/glib2.0/debian/patches/regex-if-PCRE-is-8.34-or-later-disable-auto-possessi.patch	(added)
+++ desktop/unstable/glib2.0/debian/patches/regex-if-PCRE-is-8.34-or-later-disable-auto-possessi.patch	[utf-8] Mon Aug  4 09:48:36 2014
@@ -0,0 +1,220 @@
+From e0c0836a09cac0cccfbc1c207bed7a7af1fb63fa Mon Sep 17 00:00:00 2001
+From: Simon McVittie <simon.mcvittie at collabora.co.uk>
+Date: Tue, 22 Jul 2014 09:33:39 +0100
+Subject: [PATCH 4/4] regex: if PCRE is 8.34 or later, disable
+ auto-possessification for DFA
+
+Normally, recent PCRE behaves as if certain patterns were replaced
+by a more "possessive" pattern that gives the same answer for normal
+regex matching, but is more efficient. However, the modified pattern
+produces fewer results under DFA. If we want the full set of results
+we have to apply PCRE_NO_AUTO_POSSESS, and that's a compile-time flag.
+
+This currently only affects a system PCRE, but would also work fine for
+an internal PCRE 8.34 or later if the embedded copy is updated.
+
+Bug: https://bugzilla.gnome.org/show_bug.cgi?id=733325
+---
+ glib/gregex.c | 122 ++++++++++++++++++++++++++++++++++++++++++----------------
+ 1 file changed, 89 insertions(+), 33 deletions(-)
+
+diff --git a/glib/gregex.c b/glib/gregex.c
+index 41bf67e..1022dfb 100644
+--- a/glib/gregex.c
++++ b/glib/gregex.c
+@@ -1267,6 +1267,15 @@ g_regex_unref (GRegex *regex)
+     }
+ }
+ 
++/*
++ * @match_options: (inout) (optional):
++ */
++static pcre *regex_compile (const gchar         *pattern,
++                            GRegexCompileFlags   compile_options,
++                            GRegexCompileFlags  *compile_options_out,
++                            GRegexMatchFlags    *match_options,
++                            GError             **error);
++
+ /**
+  * g_regex_new:
+  * @pattern: the regular expression
+@@ -1291,12 +1300,8 @@ g_regex_new (const gchar         *pattern,
+   GRegex *regex;
+   pcre *re;
+   const gchar *errmsg;
+-  gint erroffset;
+-  gint errcode;
+   gboolean optimize = FALSE;
+   static volatile gsize initialised = 0;
+-  unsigned long int pcre_compile_options;
+-  GRegexCompileFlags nonpcre_compile_options;
+ 
+   g_return_val_if_fail (pattern != NULL, NULL);
+   g_return_val_if_fail (error == NULL || *error == NULL, NULL);
+@@ -1325,13 +1330,61 @@ g_regex_new (const gchar         *pattern,
+       return NULL;
+     }
+ 
+-  nonpcre_compile_options = compile_options & G_REGEX_COMPILE_NONPCRE_MASK;
+-
+   /* G_REGEX_OPTIMIZE has the same numeric value of PCRE_NO_UTF8_CHECK,
+    * as we do not need to wrap PCRE_NO_UTF8_CHECK. */
+   if (compile_options & G_REGEX_OPTIMIZE)
+     optimize = TRUE;
+ 
++  re = regex_compile (pattern, compile_options, &compile_options,
++                      &match_options, error);
++
++  if (re == NULL)
++    return NULL;
++
++  regex = g_new0 (GRegex, 1);
++  regex->ref_count = 1;
++  regex->pattern = g_strdup (pattern);
++  regex->pcre_re = re;
++  regex->compile_opts = compile_options;
++  regex->match_opts = match_options;
++
++  if (optimize)
++    {
++      regex->extra = pcre_study (regex->pcre_re, 0, &errmsg);
++      if (errmsg != NULL)
++        {
++          GError *tmp_error = g_error_new (G_REGEX_ERROR,
++                                           G_REGEX_ERROR_OPTIMIZE,
++                                           _("Error while optimizing "
++                                             "regular expression %s: %s"),
++                                           regex->pattern,
++                                           errmsg);
++          g_propagate_error (error, tmp_error);
++
++          g_regex_unref (regex);
++          return NULL;
++        }
++    }
++
++  return regex;
++}
++
++static pcre *
++regex_compile (const gchar         *pattern,
++               GRegexCompileFlags   compile_options,
++               GRegexCompileFlags  *compile_options_out,
++               GRegexMatchFlags    *match_options,
++               GError             **error)
++{
++  pcre *re;
++  const gchar *errmsg;
++  gint erroffset;
++  gint errcode;
++  GRegexCompileFlags nonpcre_compile_options;
++  unsigned long int pcre_compile_options;
++
++  nonpcre_compile_options = compile_options & G_REGEX_COMPILE_NONPCRE_MASK;
++
+   /* In GRegex the string are, by default, UTF-8 encoded. PCRE
+    * instead uses UTF-8 only if required with PCRE_UTF8. */
+   if (compile_options & G_REGEX_RAW)
+@@ -1343,7 +1396,9 @@ g_regex_new (const gchar         *pattern,
+     {
+       /* enable utf-8 */
+       compile_options |= PCRE_UTF8 | PCRE_NO_UTF8_CHECK;
+-      match_options |= PCRE_NO_UTF8_CHECK;
++
++      if (match_options != NULL)
++        *match_options |= PCRE_NO_UTF8_CHECK;
+     }
+ 
+   /* PCRE_NEWLINE_ANY is the default for the internal PCRE but
+@@ -1408,32 +1463,10 @@ g_regex_new (const gchar         *pattern,
+         compile_options |= G_REGEX_DUPNAMES;
+     }
+ 
+-  regex = g_new0 (GRegex, 1);
+-  regex->ref_count = 1;
+-  regex->pattern = g_strdup (pattern);
+-  regex->pcre_re = re;
+-  regex->compile_opts = compile_options;
+-  regex->match_opts = match_options;
++  if (compile_options_out != 0)
++    *compile_options_out = compile_options;
+ 
+-  if (optimize)
+-    {
+-      regex->extra = pcre_study (regex->pcre_re, 0, &errmsg);
+-      if (errmsg != NULL)
+-        {
+-          GError *tmp_error = g_error_new (G_REGEX_ERROR,
+-                                           G_REGEX_ERROR_OPTIMIZE,
+-                                           _("Error while optimizing "
+-                                             "regular expression %s: %s"),
+-                                           regex->pattern,
+-                                           errmsg);
+-          g_propagate_error (error, tmp_error);
+-
+-          g_regex_unref (regex);
+-          return NULL;
+-        }
+-    }
+-
+-  return regex;
++  return re;
+ }
+ 
+ /**
+@@ -1873,6 +1906,7 @@ g_regex_match_all_full (const GRegex      *regex,
+ {
+   GMatchInfo *info;
+   gboolean done;
++  pcre *pcre_re;
+ 
+   g_return_val_if_fail (regex != NULL, FALSE);
+   g_return_val_if_fail (string != NULL, FALSE);
+@@ -1880,6 +1914,24 @@ g_regex_match_all_full (const GRegex      *regex,
+   g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
+   g_return_val_if_fail ((match_options & ~G_REGEX_MATCH_MASK) == 0, FALSE);
+ 
++#ifdef PCRE_NO_AUTO_POSSESS
++  /* For PCRE >= 8.34 we need to turn off PCRE_NO_AUTO_POSSESS, which
++   * is an optimization for normal regex matching, but results in omitting
++   * some shorter matches here, and an observable behaviour change.
++   *
++   * DFA matching is rather niche, and very rarely used according to
++   * codesearch.debian.net, so don't bother caching the recompiled RE. */
++  pcre_re = regex_compile (regex->pattern,
++                           regex->compile_opts | PCRE_NO_AUTO_POSSESS,
++                           NULL, NULL, error);
++
++  if (pcre_re == NULL)
++    return FALSE;
++#else
++  /* For PCRE < 8.33 the precompiled regex is fine. */
++  pcre_re = regex->pcre_re;
++#endif
++
+   info = match_info_new (regex, string, string_len, start_position,
+                          match_options, TRUE);
+ 
+@@ -1887,7 +1939,7 @@ g_regex_match_all_full (const GRegex      *regex,
+   while (!done)
+     {
+       done = TRUE;
+-      info->matches = pcre_dfa_exec (regex->pcre_re, regex->extra,
++      info->matches = pcre_dfa_exec (pcre_re, regex->extra,
+                                      info->string, info->string_len,
+                                      info->pos,
+                                      regex->match_opts | match_options,
+@@ -1917,6 +1969,10 @@ g_regex_match_all_full (const GRegex      *regex,
+         }
+     }
+ 
++#ifdef PCRE_NO_AUTO_POSSESS
++  pcre_free (pcre_re);
++#endif
++
+   /* set info->pos to -1 so that a call to g_match_info_next() fails. */
+   info->pos = -1;
+ 
+-- 
+2.0.1
+

Added: desktop/unstable/glib2.0/debian/patches/regex-test-do-not-assert-that-system-PCRE-allows-P-1.patch
URL: http://svn.debian.org/wsvn/pkg-gnome/desktop/unstable/glib2.0/debian/patches/regex-test-do-not-assert-that-system-PCRE-allows-P-1.patch?rev=42134&op=file
==============================================================================
--- desktop/unstable/glib2.0/debian/patches/regex-test-do-not-assert-that-system-PCRE-allows-P-1.patch	(added)
+++ desktop/unstable/glib2.0/debian/patches/regex-test-do-not-assert-that-system-PCRE-allows-P-1.patch	[utf-8] Mon Aug  4 09:48:36 2014
@@ -0,0 +1,32 @@
+From 070c9e965ac43f851bebc1ed653e9b468ec73cc8 Mon Sep 17 00:00:00 2001
+From: Simon McVittie <simon.mcvittie at collabora.co.uk>
+Date: Sun, 20 Jul 2014 19:34:54 +0100
+Subject: [PATCH 3/4] regex test: do not assert that system PCRE allows
+ "(?P<1>)"
+
+Perl >= 5.18, and PCRE >= 8.34, disallow this.
+
+Bug: https://bugzilla.gnome.org/show_bug.cgi?id=733325
+---
+ glib/tests/regex.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/glib/tests/regex.c b/glib/tests/regex.c
+index 95b2360..b317501 100644
+--- a/glib/tests/regex.c
++++ b/glib/tests/regex.c
+@@ -2632,8 +2632,11 @@ main (int argc, char *argv[])
+   TEST_EXPAND("a", "a", "\\0130", FALSE, "X");
+   TEST_EXPAND("a", "a", "\\\\\\0", FALSE, "\\a");
+   TEST_EXPAND("a(?P<G>.)c", "xabcy", "X\\g<G>X", FALSE, "XbX");
++#ifndef USE_SYSTEM_PCRE
++  /* PCRE >= 8.34 no longer allows this usage. */
+   TEST_EXPAND("(.)(?P<1>.)", "ab", "\\1", FALSE, "a");
+   TEST_EXPAND("(.)(?P<1>.)", "ab", "\\g<1>", FALSE, "a");
++#endif
+   TEST_EXPAND(".", EURO, "\\0", FALSE, EURO);
+   TEST_EXPAND("(.)", EURO, "\\1", FALSE, EURO);
+   TEST_EXPAND("(?P<G>.)", EURO, "\\g<G>", FALSE, EURO);
+-- 
+2.0.1
+

Added: desktop/unstable/glib2.0/debian/patches/regex-test-do-not-assert-that-system-PCRE-still-has-.patch
URL: http://svn.debian.org/wsvn/pkg-gnome/desktop/unstable/glib2.0/debian/patches/regex-test-do-not-assert-that-system-PCRE-still-has-.patch?rev=42134&op=file
==============================================================================
--- desktop/unstable/glib2.0/debian/patches/regex-test-do-not-assert-that-system-PCRE-still-has-.patch	(added)
+++ desktop/unstable/glib2.0/debian/patches/regex-test-do-not-assert-that-system-PCRE-still-has-.patch	[utf-8] Mon Aug  4 09:48:36 2014
@@ -0,0 +1,34 @@
+From 593b7d5f100e4893b8b958f8ca0dc84c7a08d579 Mon Sep 17 00:00:00 2001
+From: Simon McVittie <simon.mcvittie at collabora.co.uk>
+Date: Sun, 20 Jul 2014 19:33:59 +0100
+Subject: [PATCH 2/4] regex test: do not assert that system PCRE still has an
+ 8.31 bug
+
+This was fixed in 8.32.
+
+Bug: https://bugzilla.gnome.org/show_bug.cgi?id=733325
+---
+ glib/tests/regex.c | 6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/glib/tests/regex.c b/glib/tests/regex.c
+index 833e585..95b2360 100644
+--- a/glib/tests/regex.c
++++ b/glib/tests/regex.c
+@@ -2446,8 +2446,12 @@ main (int argc, char *argv[])
+   /* Test that othercasing in our pcre/glib integration is bug-for-bug compatible
+    * with pcre's internal tables. Bug #678273 */
+   TEST_MATCH("[DŽ]", G_REGEX_CASELESS, 0, "DŽ", -1, 0, 0, TRUE);
+-  TEST_MATCH("[DŽ]", G_REGEX_CASELESS, 0, "Dž", -1, 0, 0, FALSE);
+   TEST_MATCH("[DŽ]", G_REGEX_CASELESS, 0, "dž", -1, 0, 0, TRUE);
++#ifndef USE_SYSTEM_PCRE
++  /* This is a bug, which was fixed in 8.32. A system pcre might
++   * be that version or newer, so we cannot assert that it has this bug. */
++  TEST_MATCH("[DŽ]", G_REGEX_CASELESS, 0, "Dž", -1, 0, 0, FALSE);
++#endif
+ 
+   /* TEST_MATCH_NEXT#(pattern, string, string_len, start_position, ...) */
+   TEST_MATCH_NEXT0("a", "x", -1, 0);
+-- 
+2.0.1
+

Modified: desktop/unstable/glib2.0/debian/patches/series
URL: http://svn.debian.org/wsvn/pkg-gnome/desktop/unstable/glib2.0/debian/patches/series?rev=42134&op=diff
==============================================================================
--- desktop/unstable/glib2.0/debian/patches/series	[utf-8] (original)
+++ desktop/unstable/glib2.0/debian/patches/series	[utf-8] Mon Aug  4 09:48:36 2014
@@ -18,3 +18,7 @@
 81-skip-monitor-test-on-non-linux.patch
 0001-timer-test-use-volatile-for-locals.patch
 skip-broken-timer-test.patch
+regex-if-PCRE-is-8.34-or-later-disable-auto-possessi.patch
+regex-test-do-not-assert-that-system-PCRE-allows-P-1.patch
+regex-test-do-not-assert-that-system-PCRE-still-has-.patch
+gvariant-tests-workaround-libc-compiler-issue.patch




More information about the pkg-gnome-commits mailing list