Gentoo Archives: gentoo-commits

From: "Anthony G. Basile" <blueness@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/grs:desktop-amd64-musl-hardened commit in: core/etc/portage/patches/dev-libs/glib/
Date: Thu, 25 Feb 2016 10:05:58
Message-Id: 1456395335.bb08a88c4e2db3ea1c713b3de987c3bed4229c54.blueness@gentoo
1 commit: bb08a88c4e2db3ea1c713b3de987c3bed4229c54
2 Author: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
3 AuthorDate: Thu Feb 25 10:15:35 2016 +0000
4 Commit: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
5 CommitDate: Thu Feb 25 10:15:35 2016 +0000
6 URL: https://gitweb.gentoo.org/proj/grs.git/commit/?id=bb08a88c
7
8 patch: fix dev-libs/glib-2.46.2-r1, bug #575614
9
10 .../patches/dev-libs/glib/glib-fix-ctors.patch | 112 +++++++++++++++++++++
11 1 file changed, 112 insertions(+)
12
13 diff --git a/core/etc/portage/patches/dev-libs/glib/glib-fix-ctors.patch b/core/etc/portage/patches/dev-libs/glib/glib-fix-ctors.patch
14 new file mode 100644
15 index 0000000..ece936a
16 --- /dev/null
17 +++ b/core/etc/portage/patches/dev-libs/glib/glib-fix-ctors.patch
18 @@ -0,0 +1,112 @@
19 +See: https://bugs.gentoo.org/show_bug.cgi?id=575614
20 +
21 +From ca32c60a815f91a28e63993e9b53a2cfa0764240 Mon Sep 17 00:00:00 2001
22 +From: Natanael Copa <ncopa@×××××××××××.org>
23 +Date: Fri, 2 Oct 2015 08:11:53 +0200
24 +Subject: [PATCH] Revert "Move quark initialization to a constructor"
25 +
26 +musl's does not run ctors in the assumed order that glib-2.46 expects:
27 +
28 +- glib_init() should be called before gobject_init_ctor().
29 +
30 +This reverts commit 2fe992b099bfd3fb121a71b7af43e116b2142b5d.
31 +---
32 + glib/glib-init.c | 1 -
33 + glib/glib-init.h | 2 --
34 + glib/gquark.c | 26 ++++++++++++--------------
35 + 3 files changed, 12 insertions(+), 17 deletions(-)
36 +
37 +diff --git a/glib/glib-init.c b/glib/glib-init.c
38 +index e7002e6..24efe9d 100644
39 +--- a/glib/glib-init.c
40 ++++ b/glib/glib-init.c
41 +@@ -233,7 +233,6 @@ glib_init (void)
42 + {
43 + g_messages_prefixed_init ();
44 + g_debug_init ();
45 +- g_quark_init ();
46 + }
47 +
48 + #if defined (G_OS_WIN32)
49 +diff --git a/glib/glib-init.h b/glib/glib-init.h
50 +index b56f7e2..de6be78 100644
51 +--- a/glib/glib-init.h
52 ++++ b/glib/glib-init.h
53 +@@ -25,8 +25,6 @@
54 + extern GLogLevelFlags g_log_always_fatal;
55 + extern GLogLevelFlags g_log_msg_prefix;
56 +
57 +-void g_quark_init (void);
58 +-
59 + #ifdef G_OS_WIN32
60 + #include <windows.h>
61 +
62 +diff --git a/glib/gquark.c b/glib/gquark.c
63 +index 9e51a92..d620533 100644
64 +--- a/glib/gquark.c
65 ++++ b/glib/gquark.c
66 +@@ -40,7 +40,6 @@
67 + #include "gthread.h"
68 + #include "gtestutils.h"
69 + #include "glib_trace.h"
70 +-#include "glib-init.h"
71 +
72 + #define QUARK_BLOCK_SIZE 2048
73 + #define QUARK_STRING_BLOCK_SIZE (4096 - sizeof (gsize))
74 +@@ -54,16 +53,6 @@ static gint quark_seq_id = 0;
75 + static gchar *quark_block = NULL;
76 + static gint quark_block_offset = 0;
77 +
78 +-void
79 +-g_quark_init (void)
80 +-{
81 +- g_assert (quark_seq_id == 0);
82 +- quark_ht = g_hash_table_new (g_str_hash, g_str_equal);
83 +- quarks = g_new (gchar*, QUARK_BLOCK_SIZE);
84 +- quarks[0] = NULL;
85 +- quark_seq_id = 1;
86 +-}
87 +-
88 + /**
89 + * SECTION:quarks
90 + * @title: Quarks
91 +@@ -138,9 +127,10 @@ g_quark_try_string (const gchar *string)
92 + return 0;
93 +
94 + G_LOCK (quark_global);
95 +- quark = GPOINTER_TO_UINT (g_hash_table_lookup (quark_ht, string));
96 ++ if (quark_ht)
97 ++ quark = GPOINTER_TO_UINT (g_hash_table_lookup (quark_ht, string));
98 + G_UNLOCK (quark_global);
99 +-
100 ++
101 + return quark;
102 + }
103 +
104 +@@ -179,7 +169,8 @@ quark_from_string (const gchar *string,
105 + {
106 + GQuark quark = 0;
107 +
108 +- quark = GPOINTER_TO_UINT (g_hash_table_lookup (quark_ht, string));
109 ++ if (quark_ht)
110 ++ quark = GPOINTER_TO_UINT (g_hash_table_lookup (quark_ht, string));
111 +
112 + if (!quark)
113 + {
114 +@@ -292,6 +283,13 @@ quark_new (gchar *string)
115 + */
116 + g_atomic_pointer_set (&quarks, quarks_new);
117 + }
118 ++ if (!quark_ht)
119 ++ {
120 ++ g_assert (quark_seq_id == 0);
121 ++ quark_ht = g_hash_table_new (g_str_hash, g_str_equal);
122 ++ quarks[quark_seq_id] = NULL;
123 ++ g_atomic_int_inc (&quark_seq_id);
124 ++ }
125 +
126 + quark = quark_seq_id;
127 + g_atomic_pointer_set (&quarks[quark], string);
128 +--
129 +2.6.0
130 +