Gentoo Archives: gentoo-commits

From: "Anthony G. Basile" <blueness@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/hardened-dev:musl commit in: dev-libs/libxml2/files/, dev-libs/libxml2/
Date: Sat, 01 Nov 2014 16:16:33
Message-Id: 1414858525.119d10f79db171fa19b5ebee44d38a05b8c57108.blueness@gentoo
1 commit: 119d10f79db171fa19b5ebee44d38a05b8c57108
2 Author: Felix Janda <felix.janda <AT> posteo <DOT> de>
3 AuthorDate: Thu Oct 30 21:17:51 2014 +0000
4 Commit: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
5 CommitDate: Sat Nov 1 16:15:25 2014 +0000
6 URL: http://sources.gentoo.org/gitweb/?p=proj/hardened-dev.git;a=commit;h=119d10f7
7
8 dev-libs/libxml2-2.9.1: sync with r4
9
10 Signed-off-by: Anthony G. Basile <blueness <AT> gentoo.org>
11
12 ---
13 .../libxml2-2.9.1-external-param-entities.patch | 39 +++++++
14 .../files/libxml2-2.9.1-icu-pkgconfig.patch | 26 +++++
15 .../files/libxml2-2.9.1-xmllint-postvalid.patch | 32 ++++++
16 ...-2.9.1-r99.ebuild => libxml2-2.9.1-r999.ebuild} | 116 ++++++++++++---------
17 4 files changed, 166 insertions(+), 47 deletions(-)
18
19 diff --git a/dev-libs/libxml2/files/libxml2-2.9.1-external-param-entities.patch b/dev-libs/libxml2/files/libxml2-2.9.1-external-param-entities.patch
20 new file mode 100644
21 index 0000000..81f692f
22 --- /dev/null
23 +++ b/dev-libs/libxml2/files/libxml2-2.9.1-external-param-entities.patch
24 @@ -0,0 +1,39 @@
25 +From 9cd1c3cfbd32655d60572c0a413e017260c854df Mon Sep 17 00:00:00 2001
26 +From: Daniel Veillard <veillard@××××××.com>
27 +Date: Tue, 22 Apr 2014 15:30:56 +0800
28 +Subject: [PATCH] Do not fetch external parameter entities
29 +
30 +Unless explicitely asked for when validating or replacing entities
31 +with their value. Problem pointed out by Daniel Berrange <berrange@××××××.com>
32 +---
33 + parser.c | 14 ++++++++++++++
34 + 1 file changed, 14 insertions(+)
35 +
36 +diff --git a/parser.c b/parser.c
37 +index 9347ac9..c0dea05 100644
38 +--- a/parser.c
39 ++++ b/parser.c
40 +@@ -2598,6 +2598,20 @@ xmlParserHandlePEReference(xmlParserCtxtPtr ctxt) {
41 + xmlCharEncoding enc;
42 +
43 + /*
44 ++ * Note: external parsed entities will not be loaded, it is
45 ++ * not required for a non-validating parser, unless the
46 ++ * option of validating, or substituting entities were
47 ++ * given. Doing so is far more secure as the parser will
48 ++ * only process data coming from the document entity by
49 ++ * default.
50 ++ */
51 ++ if ((entity->etype == XML_EXTERNAL_PARAMETER_ENTITY) &&
52 ++ ((ctxt->options & XML_PARSE_NOENT) == 0) &&
53 ++ ((ctxt->options & XML_PARSE_DTDVALID) == 0) &&
54 ++ (ctxt->validate == 0))
55 ++ return;
56 ++
57 ++ /*
58 + * handle the extra spaces added before and after
59 + * c.f. http://www.w3.org/TR/REC-xml#as-PE
60 + * this is done independently.
61 +--
62 +1.9.2
63 +
64
65 diff --git a/dev-libs/libxml2/files/libxml2-2.9.1-icu-pkgconfig.patch b/dev-libs/libxml2/files/libxml2-2.9.1-icu-pkgconfig.patch
66 new file mode 100644
67 index 0000000..ab33038
68 --- /dev/null
69 +++ b/dev-libs/libxml2/files/libxml2-2.9.1-icu-pkgconfig.patch
70 @@ -0,0 +1,26 @@
71 +diff --git a/configure.in b/configure.in
72 +index 7374564..13c8d4e 100644
73 +--- a/configure.in
74 ++++ b/configure.in
75 +@@ -1444,19 +1444,11 @@ XML_LIBTOOLLIBS="libxml2.la"
76 + AC_SUBST(WITH_ICONV)
77 +
78 + WITH_ICU=0
79 +-ICU_LIBS=""
80 + if test "$with_icu" != "yes" ; then
81 + echo Disabling ICU support
82 + else
83 +- ICU_CONFIG=icu-config
84 +- if ${ICU_CONFIG} --cflags >/dev/null 2>&1
85 +- then
86 +- ICU_LIBS=`${ICU_CONFIG} --ldflags`
87 +- WITH_ICU=1
88 +- echo Enabling ICU support
89 +- else
90 +- AC_MSG_ERROR([libicu config program icu-config not found])
91 +- fi
92 ++ PKG_CHECK_MODULES(ICU, icu-i18n)
93 ++ WITH_ICU=1
94 + fi
95 + AC_SUBST(WITH_ICU)
96 + AC_SUBST(ICU_LIBS)
97
98 diff --git a/dev-libs/libxml2/files/libxml2-2.9.1-xmllint-postvalid.patch b/dev-libs/libxml2/files/libxml2-2.9.1-xmllint-postvalid.patch
99 new file mode 100644
100 index 0000000..7ce2f3b
101 --- /dev/null
102 +++ b/dev-libs/libxml2/files/libxml2-2.9.1-xmllint-postvalid.patch
103 @@ -0,0 +1,32 @@
104 +From 7c3c663e4f844aaecbb0cfc29567fe2ee9506fc4 Mon Sep 17 00:00:00 2001
105 +From: Alexandre Rostovtsev <tetromino@g.o>
106 +Date: Fri, 16 May 2014 22:46:00 -0400
107 +Subject: [PATCH] xmllint: a posteriori validation needs to load exernal
108 + entities
109 +
110 +For https://bugzilla.gnome.org/show_bug.cgi?id=730290
111 +---
112 + xmllint.c | 7 ++++++-
113 + 1 file changed, 6 insertions(+), 1 deletion(-)
114 +
115 +diff --git a/xmllint.c b/xmllint.c
116 +index 9d46ac5..b142b3b 100644
117 +--- a/xmllint.c
118 ++++ b/xmllint.c
119 +@@ -3530,7 +3530,12 @@ main(int argc, char **argv) {
120 + xmlLoadExtDtdDefaultValue |= XML_COMPLETE_ATTRS;
121 + if (noent != 0) xmlSubstituteEntitiesDefault(1);
122 + #ifdef LIBXML_VALID_ENABLED
123 +- if (valid != 0) xmlDoValidityCheckingDefaultValue = 1;
124 ++ /* If we will validate only a posteriori, ensure that entities get loaded,
125 ++ * but suppress validation messages during initial parsing */
126 ++ if (postvalid != 0 && valid == 0)
127 ++ options |= XML_PARSE_DTDVALID | XML_PARSE_NOERROR | XML_PARSE_NOWARNING;
128 ++ else if (valid != 0)
129 ++ xmlDoValidityCheckingDefaultValue = 1;
130 + #endif /* LIBXML_VALID_ENABLED */
131 + if ((htmlout) && (!nowrap)) {
132 + xmlGenericError(xmlGenericErrorContext,
133 +--
134 +1.9.3
135 +
136
137 diff --git a/dev-libs/libxml2/libxml2-2.9.1-r99.ebuild b/dev-libs/libxml2/libxml2-2.9.1-r999.ebuild
138 similarity index 65%
139 rename from dev-libs/libxml2/libxml2-2.9.1-r99.ebuild
140 rename to dev-libs/libxml2/libxml2-2.9.1-r999.ebuild
141 index 8c72170..e6b597d 100644
142 --- a/dev-libs/libxml2/libxml2-2.9.1-r99.ebuild
143 +++ b/dev-libs/libxml2/libxml2-2.9.1-r999.ebuild
144 @@ -1,12 +1,12 @@
145 -# Copyright 1999-2013 Gentoo Foundation
146 +# Copyright 1999-2014 Gentoo Foundation
147 # Distributed under the terms of the GNU General Public License v2
148 -# $Header: /var/cvsroot/gentoo-x86/dev-libs/libxml2/libxml2-2.9.1-r1.ebuild,v 1.11 2013/07/21 17:55:22 ago Exp $
149 +# $Header: /var/cvsroot/gentoo-x86/dev-libs/libxml2/libxml2-2.9.1-r4.ebuild,v 1.12 2014/06/24 19:59:48 vapier Exp $
150
151 EAPI="5"
152 -PYTHON_COMPAT=( python{2_5,2_6,2_7,3_1,3_2,3_3} )
153 +PYTHON_COMPAT=( python{2_6,2_7,3_2,3_3,3_4} )
154 PYTHON_REQ_USE="xml"
155
156 -inherit libtool flag-o-matic eutils python-r1 autotools prefix
157 +inherit libtool flag-o-matic eutils python-r1 autotools prefix multilib-minimal
158
159 DESCRIPTION="Version 2 of the library to manipulate XML files"
160 HOMEPAGE="http://www.xmlsoft.org/"
161 @@ -29,15 +29,21 @@ SRC_URI="ftp://xmlsoft.org/${PN}/${PN}-${PV/_rc/-rc}.tar.gz
162 ${XSTS_HOME}/${XSTS_NAME_2}/${XSTS_TARBALL_2}
163 http://www.w3.org/XML/Test/${XMLCONF_TARBALL} )"
164
165 -RDEPEND="sys-libs/zlib:=
166 - icu? ( dev-libs/icu:= )
167 - lzma? ( app-arch/xz-utils:= )
168 +COMMON_DEPEND=">=sys-libs/zlib-1.2.8-r1:=[${MULTILIB_USEDEP}]
169 + icu? ( >=dev-libs/icu-51.2-r1:=[${MULTILIB_USEDEP}] )
170 + lzma? ( >=app-arch/xz-utils-5.0.5-r1:=[${MULTILIB_USEDEP}] )
171 python? ( ${PYTHON_DEPS} )
172 - readline? ( sys-libs/readline:= )"
173 -
174 -DEPEND="${RDEPEND}
175 + readline? ( sys-libs/readline:= )
176 +"
177 +RDEPEND="${COMMON_DEPEND}
178 + abi_x86_32? ( !<=app-emulation/emul-linux-x86-baselibs-20131008-r6
179 + !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)] )
180 +"
181 +DEPEND="${COMMON_DEPEND}
182 dev-util/gtk-doc-am
183 - hppa? ( >=sys-devel/binutils-2.15.92.0.2 )"
184 + virtual/pkgconfig
185 + hppa? ( >=sys-devel/binutils-2.15.92.0.2 )
186 +"
187
188 S="${WORKDIR}/${PN}-${PV%_rc*}"
189
190 @@ -57,6 +63,8 @@ src_unpack() {
191 }
192
193 src_prepare() {
194 + DOCS=( AUTHORS ChangeLog NEWS README* TODO* )
195 +
196 # Patches needed for prefix support
197 epatch "${FILESDIR}"/${PN}-2.7.1-catalog_path.patch
198 epatch "${FILESDIR}"/${PN}-2.8.0_rc1-winnt.patch
199 @@ -73,19 +81,25 @@ src_prepare() {
200 "${FILESDIR}/${PN}-2.9.1-python3.patch" \
201 "${FILESDIR}/${PN}-2.9.1-python3a.patch"
202
203 + # Security fixes from 2.9.2
204 + epatch "${FILESDIR}/${P}-external-param-entities.patch"
205 +
206 + # https://bugzilla.gnome.org/show_bug.cgi?id=730290
207 + epatch "${FILESDIR}/${PN}-2.9.1-xmllint-postvalid.patch"
208 +
209 # Please do not remove, as else we get references to PORTAGE_TMPDIR
210 # in /usr/lib/python?.?/site-packages/libxml2mod.la among things.
211 # We now need to run eautoreconf at the end to prevent maintainer mode.
212 # elibtoolize
213
214 - # Python bindings are built/tested/installed manually.
215 - epatch "${FILESDIR}/${PN}-2.9.0-manual-python.patch"
216 + # Use pkgconfig to find icu to properly support multilib
217 + epatch "${FILESDIR}/${PN}-2.9.1-icu-pkgconfig.patch"
218
219 epatch "${FILESDIR}/${PN}-2.9.0-remove-redundant-pthread-defs.patch"
220 eautoreconf
221 }
222
223 -src_configure() {
224 +multilib_src_configure() {
225 # filter seemingly problematic CFLAGS (#26320)
226 filter-flags -fprefetch-loop-arrays -funroll-loops
227
228 @@ -97,36 +111,57 @@ src_configure() {
229 # switch (enabling the libxml2 debug module). See bug #100898.
230
231 # --with-mem-debug causes unusual segmentation faults (bug #105120).
232 - econf \
233 - -with-html-subdir=${PF}/html \
234 - --docdir="${EPREFIX}/usr/share/doc/${PF}" \
235 - $(use_with debug run-debug) \
236 - $(use_with icu) \
237 - $(use_with lzma) \
238 - $(use_with python) \
239 - $(use_with readline) \
240 - $(use_with readline history) \
241 - $(use_enable ipv6) \
242 - $(use_enable static-libs static)
243 +
244 + libxml2_configure() {
245 + ECONF_SOURCE="${S}" econf \
246 + --with-html-subdir=${PF}/html \
247 + --docdir="${EPREFIX}/usr/share/doc/${PF}" \
248 + $(use_with debug run-debug) \
249 + $(use_with icu) \
250 + $(use_with lzma) \
251 + $(use_enable ipv6) \
252 + $(use_enable static-libs static) \
253 + $(multilib_native_use_with readline) \
254 + $(multilib_native_use_with readline history) \
255 + "$@"
256 + }
257 +
258 + libxml2_py_configure() {
259 + mkdir -p "${BUILD_DIR}" || die # ensure python build dirs exist
260 + run_in_build_dir libxml2_configure "--with-python=${PYTHON}" # odd build system
261 + }
262 +
263 + libxml2_configure --without-python # build python bindings separately
264 +
265 + if multilib_is_native_abi && use python; then
266 + python_parallel_foreach_impl libxml2_py_configure
267 + fi
268 }
269
270 -src_compile() {
271 +multilib_src_compile() {
272 default
273 - if use python; then
274 - python_copy_sources
275 - python_foreach_impl libxml2_py_emake
276 + if multilib_is_native_abi && use python; then
277 + local native_builddir=${BUILD_DIR}
278 + python_foreach_impl libxml2_py_emake top_builddir="${native_builddir}" all
279 fi
280 }
281
282 -src_test() {
283 +multilib_src_test() {
284 default
285 - use python && python_foreach_impl libxml2_py_emake test
286 + multilib_is_native_abi && use python && python_foreach_impl libxml2_py_emake test
287 }
288
289 -src_install() {
290 +multilib_src_install() {
291 emake DESTDIR="${D}" \
292 EXAMPLES_DIR="${EPREFIX}"/usr/share/doc/${PF}/examples install
293
294 + if multilib_is_native_abi && use python; then
295 + python_foreach_impl libxml2_py_emake DESTDIR="${D}" install
296 + python_foreach_impl python_optimize
297 + fi
298 +}
299 +
300 +multilib_src_install_all() {
301 # on windows, xmllint is installed by interix libxml2 in parent prefix.
302 # this is the version to use. the native winnt version does not support
303 # symlinks, which makes repoman fail if the portage tree is linked in
304 @@ -136,16 +171,8 @@ src_install() {
305 rm -rf "${ED}"/usr/bin/xmlcatalog
306 fi
307
308 - if use python; then
309 - python_foreach_impl libxml2_py_emake DESTDIR="${D}" \
310 - docsdir="${EPREFIX}"/usr/share/doc/${PF}/python \
311 - exampledir="${EPREFIX}"/usr/share/doc/${PF}/python/examples \
312 - install
313 - python_foreach_impl python_optimize
314 - fi
315 -
316 rm -rf "${ED}"/usr/share/doc/${P}
317 - dodoc AUTHORS ChangeLog Copyright NEWS README* TODO*
318 + einstalldocs
319
320 if ! use python; then
321 rm -rf "${ED}"/usr/share/doc/${PF}/python
322 @@ -182,11 +209,6 @@ pkg_postinst() {
323
324 libxml2_py_emake() {
325 pushd "${BUILD_DIR}/python" > /dev/null || die
326 - emake \
327 - PYTHON="${PYTHON}" \
328 - PYTHON_INCLUDES="${EPREFIX}/usr/include/${EPYTHON}" \
329 - PYTHON_LIBS="$(python-config --ldflags)" \
330 - PYTHON_SITE_PACKAGES="$(python_get_sitedir)" \
331 - pythondir="$(python_get_sitedir)" "$@"
332 + emake "$@"
333 popd > /dev/null
334 }