diff options
Diffstat (limited to 'dev-libs/libxml2')
-rw-r--r-- | dev-libs/libxml2/Manifest | 4 | ||||
-rw-r--r-- | dev-libs/libxml2/files/libxml2-2.7.1-catalog_path.patch | 66 | ||||
-rw-r--r-- | dev-libs/libxml2/files/libxml2-2.8.0_rc1-winnt.patch | 91 | ||||
-rw-r--r-- | dev-libs/libxml2/files/libxml2-2.9.2-constant-memory.patch | 176 | ||||
-rw-r--r-- | dev-libs/libxml2/files/libxml2-2.9.2-cross-compile.patch | 17 | ||||
-rw-r--r-- | dev-libs/libxml2/files/libxml2-2.9.2-icu-pkgconfig.patch | 26 | ||||
-rw-r--r-- | dev-libs/libxml2/files/libxml2-2.9.2-missing-entities.patch | 31 | ||||
-rw-r--r-- | dev-libs/libxml2/files/libxml2-2.9.2-revert-missing-initialization.patch | 26 | ||||
-rw-r--r-- | dev-libs/libxml2/files/libxml2-2.9.2-threads-declarations.patch | 48 | ||||
-rw-r--r-- | dev-libs/libxml2/files/libxml2-2.9.2-timsort.patch | 128 | ||||
-rw-r--r-- | dev-libs/libxml2/libxml2-2.9.2-r1.ebuild | 214 | ||||
-rw-r--r-- | dev-libs/libxml2/metadata.xml | 8 |
12 files changed, 835 insertions, 0 deletions
diff --git a/dev-libs/libxml2/Manifest b/dev-libs/libxml2/Manifest new file mode 100644 index 000000000000..bc57e91ed687 --- /dev/null +++ b/dev-libs/libxml2/Manifest @@ -0,0 +1,4 @@ +DIST libxml2-2.9.2.tar.gz 5444991 SHA256 5178c30b151d044aefb1b08bf54c3003a0ac55c59c866763997529d60770d5bc SHA512 a4e3b20e2efceed39c20379b32b746d4a1cf65c0cf7719d26c9bf7483c1f04a4e5a442ae2f36dc4ae8a4d011b67cfb58d9f6d0be034fa3e897a49059c9289565 WHIRLPOOL d7a77cb6ad49533cf62f6a759668e297a60dd7f70c9e13b29f682c64dfb25ae46eb9db552500130f40e3f969897bda996001d18236a4630e3713f6dd5acbe686 +DIST xmlts20080827.tar.gz 638940 SHA256 96151685cec997e1f9f3387e3626d61e6284d4d6e66e0e440c209286c03e9cc7 SHA512 7325d0977c4427fc4944b291ccf896a665f654cc24399e5565c12a849c2bc3aef4fa3ee42a09ac115abcb6570c51a8fbd052c38d64d164279ecdecad5a4e884d WHIRLPOOL 50835380c3ea208df0bf9ce032ed2df69c4c6cb5a53ffdd39a08fb4f1d166f311b2ef2fe0d9911ae1ebff92aeb42f6ea55e727dfe0b7a3b95e6c7240315b3eda +DIST xsts-2002-01-16.tar.gz 6894439 SHA256 55e5c08db29946a91ea8e70e8f2418d3fd30d8b6777941dfba7f54726ffd9914 SHA512 43300af6d39c1e2221b0ed7318fe14c7464eeb6eb030ed1e22eb29b4ab17f014e2a4c8887c3a46ae5d243e3072da27f00f4e285498ae6f1288177d38d1108288 WHIRLPOOL 84dd51959460a4f8aa582d57ad39229c546ca7fe155012c57c368b59f5d31400d8b940a343a7320058330ca611303139cacdffed514783f96406ac5366026b11 +DIST xsts-2004-01-14.tar.gz 2761085 SHA256 09bdf9f81f381ebf9bc158a9472e498e896f7a02eb7461146e9abe1b9493ca17 SHA512 32854388d7e720ad67156baf50bf2bae7bd878ca3e35fd7e44e57cad3f434f69d56bbbedd61509f8a1faf01c9eae74a078df8fe130780b182c05c05cb1c39ebe WHIRLPOOL c46a3bf7d6dd771757f4304995cc177cf51c6cdd0e9778851fc13d3809c7b984690b4f273b3e075abe018110968eb7fc78f5b83170d3e18bacf00a4ed64b213d diff --git a/dev-libs/libxml2/files/libxml2-2.7.1-catalog_path.patch b/dev-libs/libxml2/files/libxml2-2.7.1-catalog_path.patch new file mode 100644 index 000000000000..25ea47832b0e --- /dev/null +++ b/dev-libs/libxml2/files/libxml2-2.7.1-catalog_path.patch @@ -0,0 +1,66 @@ +--- catalog.c ++++ catalog.c +@@ -68,10 +68,10 @@ + #define XML_URN_PUBID "urn:publicid:" + #define XML_CATAL_BREAK ((xmlChar *) -1) + #ifndef XML_XML_DEFAULT_CATALOG +-#define XML_XML_DEFAULT_CATALOG "file:///etc/xml/catalog" ++#define XML_XML_DEFAULT_CATALOG "file://@GENTOO_PORTAGE_EPREFIX@/etc/xml/catalog" + #endif + #ifndef XML_SGML_DEFAULT_CATALOG +-#define XML_SGML_DEFAULT_CATALOG "file:///etc/sgml/catalog" ++#define XML_SGML_DEFAULT_CATALOG "file://@GENTOO_PORTAGE_EPREFIX@/etc/sgml/catalog" + #endif + + #if defined(_WIN32) && defined(_MSC_VER) +@@ -76,7 +76,7 @@ + + #if defined(_WIN32) && defined(_MSC_VER) + #undef XML_XML_DEFAULT_CATALOG +-static char XML_XML_DEFAULT_CATALOG[256] = "file:///etc/xml/catalog"; ++static char XML_XML_DEFAULT_CATALOG[256] = "file://@GENTOO_PORTAGE_EPREFIX@/etc/xml/catalog"; + #if defined(_WIN32_WCE) + /* Windows CE don't have a A variant */ + #define GetModuleHandleA GetModuleHandle +--- xmlcatalog.c ++++ xmlcatalog.c +@@ -43,7 +43,7 @@ + + + #ifndef XML_SGML_DEFAULT_CATALOG +-#define XML_SGML_DEFAULT_CATALOG "/etc/sgml/catalog" ++#define XML_SGML_DEFAULT_CATALOG "@GENTOO_PORTAGE_EPREFIX@/etc/sgml/catalog" + #endif + + /************************************************************************ +--- runtest.c ++++ runtest.c +@@ -2747,7 +2747,7 @@ + */ + static int + uripMatch(const char * URI) { +- if ((URI == NULL) || (!strcmp(URI, "file:///etc/xml/catalog"))) ++ if ((URI == NULL) || (!strcmp(URI, "file://@GENTOO_PORTAGE_EPREFIX@/etc/xml/catalog"))) + return(0); + /* Verify we received the escaped URL */ + if (strcmp(urip_rcvsURLs[urip_current], URI)) +@@ -2766,7 +2766,7 @@ + */ + static void * + uripOpen(const char * URI) { +- if ((URI == NULL) || (!strcmp(URI, "file:///etc/xml/catalog"))) ++ if ((URI == NULL) || (!strcmp(URI, "file://@GENTOO_PORTAGE_EPREFIX@/etc/xml/catalog"))) + return(NULL); + /* Verify we received the escaped URL */ + if (strcmp(urip_rcvsURLs[urip_current], URI)) +--- xmllint.c ++++ xmllint.c +@@ -103,7 +103,7 @@ + #endif + + #ifndef XML_XML_DEFAULT_CATALOG +-#define XML_XML_DEFAULT_CATALOG "file:///etc/xml/catalog" ++#define XML_XML_DEFAULT_CATALOG "file://@GENTOO_PORTAGE_EPREFIX@/etc/xml/catalog" + #endif + + typedef enum { diff --git a/dev-libs/libxml2/files/libxml2-2.8.0_rc1-winnt.patch b/dev-libs/libxml2/files/libxml2-2.8.0_rc1-winnt.patch new file mode 100644 index 000000000000..cce3ecb058ae --- /dev/null +++ b/dev-libs/libxml2/files/libxml2-2.8.0_rc1-winnt.patch @@ -0,0 +1,91 @@ +From 168e20836fe9614dd2dd4b42006c17a783f11c48 Mon Sep 17 00:00:00 2001 +From: Markus Duft <mduft@gentoo.org> +Date: Thu, 20 Nov 2008 11:04:33 -0500 +Subject: [PATCH] Fix for ~x86-winnt + +[Alexandre Rostovtsev <tetromino@gentoo.org>: port to 2.8.0-rc1] +--- + dict.c | 2 +- + include/wsockcompat.h | 2 +- + nanohttp.c | 2 +- + xmlIO.c | 4 ++++ + 4 files changed, 7 insertions(+), 3 deletions(-) + +diff --git a/dict.c b/dict.c +index 3579f64..71e7bc6 100644 +--- a/dict.c ++++ b/dict.c +@@ -47,7 +47,7 @@ + #else + #ifdef HAVE_INTTYPES_H + #include <inttypes.h> +-#elif defined(WIN32) ++#elif defined(WIN32) || defined (__PARITY__) + typedef unsigned __int32 uint32_t; + #endif + #endif +diff --git a/include/wsockcompat.h b/include/wsockcompat.h +index c762a64..1ed822b 100644 +--- a/include/wsockcompat.h ++++ b/include/wsockcompat.h +@@ -27,7 +27,7 @@ + #endif + #endif + +-#if defined( __MINGW32__ ) || defined( _MSC_VER ) ++#if defined( __MINGW32__ ) || defined( _MSC_VER ) || defined(__PARITY__) + /* Include <errno.h> here to ensure that it doesn't get included later + * (e.g. by iconv.h) and overwrites the definition of EWOULDBLOCK. */ + #include <errno.h> +diff --git a/nanohttp.c b/nanohttp.c +index 2437fed..dbe97a7 100644 +--- a/nanohttp.c ++++ b/nanohttp.c +@@ -74,7 +74,7 @@ + #define XML_SOCKLEN_T unsigned int + #endif + +-#if defined(__MINGW32__) || defined(_WIN32_WCE) ++#if defined(__MINGW32__) || defined(_WIN32_WCE) || defined(__PARITY__) + #ifndef _WINSOCKAPI_ + #define _WINSOCKAPI_ + #endif +diff --git a/xmlIO.c b/xmlIO.c +index 73a995d..99562f6 100644 +--- a/xmlIO.c ++++ b/xmlIO.c +@@ -47,6 +47,7 @@ + #include <winnls.h> /* for CP_UTF8 */ + #endif + ++#ifndef __PARITY__ + /* Figure a portable way to know if a file is a directory. */ + #ifndef HAVE_STAT + # ifdef HAVE__STAT +@@ -82,6 +83,7 @@ + # endif + # endif + #endif ++#endif /* __PARITY__ */ + + #include <libxml/xmlmemory.h> + #include <libxml/parser.h> +@@ -657,6 +659,7 @@ xmlWrapStatUtf8(const char *path,struct stat *info) + { + #ifdef HAVE_STAT + int retval = -1; ++#ifndef __PARITY__ + wchar_t *wPath; + + wPath = __xmlIOWin32UTF8ToWChar(path); +@@ -665,6 +668,7 @@ xmlWrapStatUtf8(const char *path,struct stat *info) + retval = _wstat(wPath,info); + xmlFree(wPath); + } ++#endif + /* maybe path in native encoding */ + if(retval < 0) + retval = stat(path,info); +-- +1.7.8.6 + diff --git a/dev-libs/libxml2/files/libxml2-2.9.2-constant-memory.patch b/dev-libs/libxml2/files/libxml2-2.9.2-constant-memory.patch new file mode 100644 index 000000000000..dc944b6353ea --- /dev/null +++ b/dev-libs/libxml2/files/libxml2-2.9.2-constant-memory.patch @@ -0,0 +1,176 @@ +From 213f1fe0d76d30eaed6e5853057defc43e6df2c9 Mon Sep 17 00:00:00 2001 +From: Daniel Veillard <veillard@redhat.com> +Date: Tue, 14 Apr 2015 17:41:48 +0800 +Subject: [PATCH] CVE-2015-1819 Enforce the reader to run in constant memory + +One of the operation on the reader could resolve entities +leading to the classic expansion issue. Make sure the +buffer used for xmlreader operation is bounded. +Introduce a new allocation type for the buffers for this effect. +--- + buf.c | 43 ++++++++++++++++++++++++++++++++++++++++++- + include/libxml/tree.h | 3 ++- + xmlreader.c | 20 +++++++++++++++++++- + 3 files changed, 63 insertions(+), 3 deletions(-) + +diff --git a/buf.c b/buf.c +index 6efc7b6..07922ff 100644 +--- a/buf.c ++++ b/buf.c +@@ -27,6 +27,7 @@ + #include <libxml/tree.h> + #include <libxml/globals.h> + #include <libxml/tree.h> ++#include <libxml/parserInternals.h> /* for XML_MAX_TEXT_LENGTH */ + #include "buf.h" + + #define WITH_BUFFER_COMPAT +@@ -299,7 +300,8 @@ xmlBufSetAllocationScheme(xmlBufPtr buf, + if ((scheme == XML_BUFFER_ALLOC_DOUBLEIT) || + (scheme == XML_BUFFER_ALLOC_EXACT) || + (scheme == XML_BUFFER_ALLOC_HYBRID) || +- (scheme == XML_BUFFER_ALLOC_IMMUTABLE)) { ++ (scheme == XML_BUFFER_ALLOC_IMMUTABLE) || ++ (scheme == XML_BUFFER_ALLOC_BOUNDED)) { + buf->alloc = scheme; + if (buf->buffer) + buf->buffer->alloc = scheme; +@@ -458,6 +460,18 @@ xmlBufGrowInternal(xmlBufPtr buf, size_t len) { + size = buf->use + len + 100; + #endif + ++ if (buf->alloc == XML_BUFFER_ALLOC_BOUNDED) { ++ /* ++ * Used to provide parsing limits ++ */ ++ if ((buf->use + len >= XML_MAX_TEXT_LENGTH) || ++ (buf->size >= XML_MAX_TEXT_LENGTH)) { ++ xmlBufMemoryError(buf, "buffer error: text too long\n"); ++ return(0); ++ } ++ if (size >= XML_MAX_TEXT_LENGTH) ++ size = XML_MAX_TEXT_LENGTH; ++ } + if ((buf->alloc == XML_BUFFER_ALLOC_IO) && (buf->contentIO != NULL)) { + size_t start_buf = buf->content - buf->contentIO; + +@@ -739,6 +753,15 @@ xmlBufResize(xmlBufPtr buf, size_t size) + CHECK_COMPAT(buf) + + if (buf->alloc == XML_BUFFER_ALLOC_IMMUTABLE) return(0); ++ if (buf->alloc == XML_BUFFER_ALLOC_BOUNDED) { ++ /* ++ * Used to provide parsing limits ++ */ ++ if (size >= XML_MAX_TEXT_LENGTH) { ++ xmlBufMemoryError(buf, "buffer error: text too long\n"); ++ return(0); ++ } ++ } + + /* Don't resize if we don't have to */ + if (size < buf->size) +@@ -867,6 +890,15 @@ xmlBufAdd(xmlBufPtr buf, const xmlChar *str, int len) { + + needSize = buf->use + len + 2; + if (needSize > buf->size){ ++ if (buf->alloc == XML_BUFFER_ALLOC_BOUNDED) { ++ /* ++ * Used to provide parsing limits ++ */ ++ if (needSize >= XML_MAX_TEXT_LENGTH) { ++ xmlBufMemoryError(buf, "buffer error: text too long\n"); ++ return(-1); ++ } ++ } + if (!xmlBufResize(buf, needSize)){ + xmlBufMemoryError(buf, "growing buffer"); + return XML_ERR_NO_MEMORY; +@@ -938,6 +970,15 @@ xmlBufAddHead(xmlBufPtr buf, const xmlChar *str, int len) { + } + needSize = buf->use + len + 2; + if (needSize > buf->size){ ++ if (buf->alloc == XML_BUFFER_ALLOC_BOUNDED) { ++ /* ++ * Used to provide parsing limits ++ */ ++ if (needSize >= XML_MAX_TEXT_LENGTH) { ++ xmlBufMemoryError(buf, "buffer error: text too long\n"); ++ return(-1); ++ } ++ } + if (!xmlBufResize(buf, needSize)){ + xmlBufMemoryError(buf, "growing buffer"); + return XML_ERR_NO_MEMORY; +diff --git a/include/libxml/tree.h b/include/libxml/tree.h +index 2f90717..4a9b3bc 100644 +--- a/include/libxml/tree.h ++++ b/include/libxml/tree.h +@@ -76,7 +76,8 @@ typedef enum { + XML_BUFFER_ALLOC_EXACT, /* grow only to the minimal size */ + XML_BUFFER_ALLOC_IMMUTABLE, /* immutable buffer */ + XML_BUFFER_ALLOC_IO, /* special allocation scheme used for I/O */ +- XML_BUFFER_ALLOC_HYBRID /* exact up to a threshold, and doubleit thereafter */ ++ XML_BUFFER_ALLOC_HYBRID, /* exact up to a threshold, and doubleit thereafter */ ++ XML_BUFFER_ALLOC_BOUNDED /* limit the upper size of the buffer */ + } xmlBufferAllocationScheme; + + /** +diff --git a/xmlreader.c b/xmlreader.c +index f19e123..471e7e2 100644 +--- a/xmlreader.c ++++ b/xmlreader.c +@@ -2091,6 +2091,9 @@ xmlNewTextReader(xmlParserInputBufferPtr input, const char *URI) { + "xmlNewTextReader : malloc failed\n"); + return(NULL); + } ++ /* no operation on a reader should require a huge buffer */ ++ xmlBufSetAllocationScheme(ret->buffer, ++ XML_BUFFER_ALLOC_BOUNDED); + ret->sax = (xmlSAXHandler *) xmlMalloc(sizeof(xmlSAXHandler)); + if (ret->sax == NULL) { + xmlBufFree(ret->buffer); +@@ -3616,6 +3619,7 @@ xmlTextReaderConstValue(xmlTextReaderPtr reader) { + return(((xmlNsPtr) node)->href); + case XML_ATTRIBUTE_NODE:{ + xmlAttrPtr attr = (xmlAttrPtr) node; ++ const xmlChar *ret; + + if ((attr->children != NULL) && + (attr->children->type == XML_TEXT_NODE) && +@@ -3629,10 +3633,21 @@ xmlTextReaderConstValue(xmlTextReaderPtr reader) { + "xmlTextReaderSetup : malloc failed\n"); + return (NULL); + } ++ xmlBufSetAllocationScheme(reader->buffer, ++ XML_BUFFER_ALLOC_BOUNDED); + } else + xmlBufEmpty(reader->buffer); + xmlBufGetNodeContent(reader->buffer, node); +- return(xmlBufContent(reader->buffer)); ++ ret = xmlBufContent(reader->buffer); ++ if (ret == NULL) { ++ /* error on the buffer best to reallocate */ ++ xmlBufFree(reader->buffer); ++ reader->buffer = xmlBufCreateSize(100); ++ xmlBufSetAllocationScheme(reader->buffer, ++ XML_BUFFER_ALLOC_BOUNDED); ++ ret = BAD_CAST ""; ++ } ++ return(ret); + } + break; + } +@@ -5131,6 +5146,9 @@ xmlTextReaderSetup(xmlTextReaderPtr reader, + "xmlTextReaderSetup : malloc failed\n"); + return (-1); + } ++ /* no operation on a reader should require a huge buffer */ ++ xmlBufSetAllocationScheme(reader->buffer, ++ XML_BUFFER_ALLOC_BOUNDED); + if (reader->sax == NULL) + reader->sax = (xmlSAXHandler *) xmlMalloc(sizeof(xmlSAXHandler)); + if (reader->sax == NULL) { +-- +2.3.5 + diff --git a/dev-libs/libxml2/files/libxml2-2.9.2-cross-compile.patch b/dev-libs/libxml2/files/libxml2-2.9.2-cross-compile.patch new file mode 100644 index 000000000000..447222eeefb7 --- /dev/null +++ b/dev-libs/libxml2/files/libxml2-2.9.2-cross-compile.patch @@ -0,0 +1,17 @@ +https://bugzilla.gnome.org/show_bug.cgi?id=749416 + +do not use -L$Z_DIR/lib when Z_DIR isn't actually set + +--- a/configure.ac ++++ b/configure.ac +@@ -392,7 +392,9 @@ if test "$with_zlib" = "no"; then + else + AC_CHECK_HEADERS(zlib.h, + [SAVE_LDFLAGS="${LDFLAGS}" +- LDFLAGS="-L${Z_DIR}/lib" ++ if test "x${Z_DIR}" != "x"; then ++ LDFLAGS="${LDFLAGS} -L${Z_DIR}/lib" ++ fi + AC_CHECK_LIB(z, gzread,[ + AC_DEFINE([HAVE_LIBZ], [1], [Have compression library]) + WITH_ZLIB=1 diff --git a/dev-libs/libxml2/files/libxml2-2.9.2-icu-pkgconfig.patch b/dev-libs/libxml2/files/libxml2-2.9.2-icu-pkgconfig.patch new file mode 100644 index 000000000000..7a84fac53e66 --- /dev/null +++ b/dev-libs/libxml2/files/libxml2-2.9.2-icu-pkgconfig.patch @@ -0,0 +1,26 @@ +diff --git a/configure.in b/configure.in +index 7374564..13c8d4e 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -1444,19 +1444,11 @@ XML_LIBTOOLLIBS="libxml2.la" + AC_SUBST(WITH_ICONV) + + WITH_ICU=0 +-ICU_LIBS="" + if test "$with_icu" != "yes" ; then + echo Disabling ICU support + else +- ICU_CONFIG=icu-config +- if ${ICU_CONFIG} --cflags >/dev/null 2>&1 +- then +- ICU_LIBS=`${ICU_CONFIG} --ldflags` +- WITH_ICU=1 +- echo Enabling ICU support +- else +- AC_MSG_ERROR([libicu config program icu-config not found]) +- fi ++ PKG_CHECK_MODULES(ICU, icu-i18n) ++ WITH_ICU=1 + fi + AC_SUBST(WITH_ICU) + AC_SUBST(ICU_LIBS) diff --git a/dev-libs/libxml2/files/libxml2-2.9.2-missing-entities.patch b/dev-libs/libxml2/files/libxml2-2.9.2-missing-entities.patch new file mode 100644 index 000000000000..7a10e206ad82 --- /dev/null +++ b/dev-libs/libxml2/files/libxml2-2.9.2-missing-entities.patch @@ -0,0 +1,31 @@ +From 72a46a519ce7326d9a00f0b6a7f2a8e958cd1675 Mon Sep 17 00:00:00 2001 +From: Daniel Veillard <veillard@redhat.com> +Date: Thu, 23 Oct 2014 11:35:36 +0800 +Subject: [PATCH] Fix missing entities after CVE-2014-3660 fix + +For https://bugzilla.gnome.org/show_bug.cgi?id=738805 + +The fix for CVE-2014-3660 introduced a regression in some case +where entity substitution is required and the entity is used +first in anotther entity referenced from an attribute value +--- + parser.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/parser.c b/parser.c +index 67c9dfd..a8d1b67 100644 +--- a/parser.c ++++ b/parser.c +@@ -7235,7 +7235,8 @@ xmlParseReference(xmlParserCtxtPtr ctxt) { + * far more secure as the parser will only process data coming from + * the document entity by default. + */ +- if ((ent->checked == 0) && ++ if (((ent->checked == 0) || ++ ((ent->children == NULL) && (ctxt->options & XML_PARSE_NOENT))) && + ((ent->etype != XML_EXTERNAL_GENERAL_PARSED_ENTITY) || + (ctxt->options & (XML_PARSE_NOENT | XML_PARSE_DTDVALID)))) { + unsigned long oldnbent = ctxt->nbentities; +-- +2.3.5 + diff --git a/dev-libs/libxml2/files/libxml2-2.9.2-revert-missing-initialization.patch b/dev-libs/libxml2/files/libxml2-2.9.2-revert-missing-initialization.patch new file mode 100644 index 000000000000..d98b38211605 --- /dev/null +++ b/dev-libs/libxml2/files/libxml2-2.9.2-revert-missing-initialization.patch @@ -0,0 +1,26 @@ +From f65128f38289d77ff322d63aef2858cc0a819c34 Mon Sep 17 00:00:00 2001 +From: Daniel Veillard <veillard@redhat.com> +Date: Fri, 17 Oct 2014 17:13:41 +0800 +Subject: Revert "Missing initialization for the catalog module" + +This reverts commit 054c716ea1bf001544127a4ab4f4346d1b9947e7. +As this break xmlcatalog command +https://bugzilla.redhat.com/show_bug.cgi?id=1153753 + +diff --git a/parser.c b/parser.c +index 1d93967..67c9dfd 100644 +--- a/parser.c ++++ b/parser.c +@@ -14830,9 +14830,6 @@ xmlInitParser(void) { + #ifdef LIBXML_XPATH_ENABLED + xmlXPathInit(); + #endif +-#ifdef LIBXML_CATALOG_ENABLED +- xmlInitializeCatalog(); +-#endif + xmlParserInitialized = 1; + #ifdef LIBXML_THREAD_ENABLED + } +-- +cgit v0.10.1 + diff --git a/dev-libs/libxml2/files/libxml2-2.9.2-threads-declarations.patch b/dev-libs/libxml2/files/libxml2-2.9.2-threads-declarations.patch new file mode 100644 index 000000000000..1236f622d6a4 --- /dev/null +++ b/dev-libs/libxml2/files/libxml2-2.9.2-threads-declarations.patch @@ -0,0 +1,48 @@ +From fff8a6b87e05200a0ad0af6f86c2e859c7de9172 Mon Sep 17 00:00:00 2001 +From: Michael Heimpold <mhei@heimpold.de> +Date: Mon, 22 Dec 2014 11:12:12 +0800 +Subject: [PATCH] threads: use forward declarations only for glibc + +Fixes bug #704908 + +The declarations of pthread functions, used to generate weak references +to them, fail to suppress macros. Thus, if any pthread function has +been provided as a macro, compiling threads.c will fail. +This breaks on musl libc, which defines pthread_equal as a macro (in +addition to providing the function, as required). + +Prevent the declarations for e.g. musl libc by refining the condition. + +The idea for this solution was borrowed from the alpine linux guys, see +http://git.alpinelinux.org/cgit/aports/tree/main/libxml2/libxml2-pthread.patch + +Signed-off-by: Michael Heimpold <mhei@heimpold.de> +--- + threads.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/threads.c b/threads.c +index 8921204..78006a2 100644 +--- a/threads.c ++++ b/threads.c +@@ -47,7 +47,7 @@ + #ifdef HAVE_PTHREAD_H + + static int libxml_is_threaded = -1; +-#ifdef __GNUC__ ++#if defined(__GNUC__) && defined(__GLIBC__) + #ifdef linux + #if (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || (__GNUC__ > 3) + extern int pthread_once (pthread_once_t *__once_control, +@@ -89,7 +89,7 @@ extern int pthread_cond_signal () + __attribute((weak)); + #endif + #endif /* linux */ +-#endif /* __GNUC__ */ ++#endif /* defined(__GNUC__) && defined(__GLIBC__) */ + #endif /* HAVE_PTHREAD_H */ + + /* +-- +2.3.5 + diff --git a/dev-libs/libxml2/files/libxml2-2.9.2-timsort.patch b/dev-libs/libxml2/files/libxml2-2.9.2-timsort.patch new file mode 100644 index 000000000000..c179d47ef2db --- /dev/null +++ b/dev-libs/libxml2/files/libxml2-2.9.2-timsort.patch @@ -0,0 +1,128 @@ +From 9b987f8c98763ee569bde90b5268b43474ca106c Mon Sep 17 00:00:00 2001 +From: Christopher Swenson <chris@caswenson.com> +Date: Fri, 27 Feb 2015 14:55:49 +0800 +Subject: [PATCH] Fix timsort invariant loop re: Envisage article + +See http://envisage-project.eu/proving-android-java-and-python-sorting-algorithm-is-broken-and-how-to-fix-it/ + +We use a "runLen" array of size 128, so it should be nearly impossible +to have our implementation overflow. + +But in any case, the fix is relatively simple -- checking two extra +conditions in the invariant calculation. + +I also took this opportunity to remove some redundancy in the +left/right merge logic in the invariant loop. +--- + timsort.h | 74 +++++++++++++++++++++++++++++++++------------------------------ + 1 file changed, 39 insertions(+), 35 deletions(-) + +diff --git a/timsort.h b/timsort.h +index efa3aab..795f272 100644 +--- a/timsort.h ++++ b/timsort.h +@@ -392,62 +392,66 @@ static void TIM_SORT_MERGE(SORT_TYPE *dst, const TIM_SORT_RUN_T *stack, const in + + static int TIM_SORT_COLLAPSE(SORT_TYPE *dst, TIM_SORT_RUN_T *stack, int stack_curr, TEMP_STORAGE_T *store, const size_t size) + { +- while (1) +- { +- int64_t A, B, C; ++ while (1) { ++ int64_t A, B, C, D; ++ int ABC, BCD, BD, CD; ++ + /* if the stack only has one thing on it, we are done with the collapse */ +- if (stack_curr <= 1) break; ++ if (stack_curr <= 1) { ++ break; ++ } ++ + /* if this is the last merge, just do it */ +- if ((stack_curr == 2) && +- (stack[0].length + stack[1].length == (int64_t) size)) +- { ++ if ((stack_curr == 2) && (stack[0].length + stack[1].length == size)) { + TIM_SORT_MERGE(dst, stack, stack_curr, store); + stack[0].length += stack[1].length; + stack_curr--; + break; + } + /* check if the invariant is off for a stack of 2 elements */ +- else if ((stack_curr == 2) && (stack[0].length <= stack[1].length)) +- { ++ else if ((stack_curr == 2) && (stack[0].length <= stack[1].length)) { + TIM_SORT_MERGE(dst, stack, stack_curr, store); + stack[0].length += stack[1].length; + stack_curr--; + break; +- } +- else if (stack_curr == 2) ++ } else if (stack_curr == 2) { + break; ++ } + +- A = stack[stack_curr - 3].length; +- B = stack[stack_curr - 2].length; +- C = stack[stack_curr - 1].length; ++ B = stack[stack_curr - 3].length; ++ C = stack[stack_curr - 2].length; ++ D = stack[stack_curr - 1].length; + +- /* check first invariant */ +- if (A <= B + C) +- { +- if (A < C) +- { +- TIM_SORT_MERGE(dst, stack, stack_curr - 1, store); +- stack[stack_curr - 3].length += stack[stack_curr - 2].length; +- stack[stack_curr - 2] = stack[stack_curr - 1]; +- stack_curr--; +- } +- else +- { +- TIM_SORT_MERGE(dst, stack, stack_curr, store); +- stack[stack_curr - 2].length += stack[stack_curr - 1].length; +- stack_curr--; +- } ++ if (stack_curr >= 4) { ++ A = stack[stack_curr - 4].length; ++ ABC = (A <= B + C); ++ } else { ++ ABC = 0; + } +- /* check second invariant */ +- else if (B <= C) +- { ++ ++ BCD = (B <= C + D) || ABC; ++ CD = (C <= D); ++ BD = (B < D); ++ ++ /* Both invariants are good */ ++ if (!BCD && !CD) { ++ break; ++ } ++ ++ /* left merge */ ++ if (BCD && !CD) { ++ TIM_SORT_MERGE(dst, stack, stack_curr - 1, store); ++ stack[stack_curr - 3].length += stack[stack_curr - 2].length; ++ stack[stack_curr - 2] = stack[stack_curr - 1]; ++ stack_curr--; ++ } else { ++ /* right merge */ + TIM_SORT_MERGE(dst, stack, stack_curr, store); + stack[stack_curr - 2].length += stack[stack_curr - 1].length; + stack_curr--; + } +- else +- break; + } ++ + return stack_curr; + } + +-- +2.3.5 + diff --git a/dev-libs/libxml2/libxml2-2.9.2-r1.ebuild b/dev-libs/libxml2/libxml2-2.9.2-r1.ebuild new file mode 100644 index 000000000000..2cfe948e2515 --- /dev/null +++ b/dev-libs/libxml2/libxml2-2.9.2-r1.ebuild @@ -0,0 +1,214 @@ +# Copyright 1999-2015 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +EAPI="5" +PYTHON_COMPAT=( python{2_7,3_3,3_4} ) +PYTHON_REQ_USE="xml" + +inherit libtool flag-o-matic eutils python-r1 autotools prefix multilib-minimal + +DESCRIPTION="Version 2 of the library to manipulate XML files" +HOMEPAGE="http://www.xmlsoft.org/" + +LICENSE="MIT" +SLOT="2" +KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~ppc-aix ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~x64-freebsd ~x86-freebsd ~hppa-hpux ~ia64-hpux ~x86-interix ~amd64-linux ~arm-linux ~ia64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris ~x86-winnt" +IUSE="debug examples icu ipv6 lzma python readline static-libs test" + +XSTS_HOME="http://www.w3.org/XML/2004/xml-schema-test-suite" +XSTS_NAME_1="xmlschema2002-01-16" +XSTS_NAME_2="xmlschema2004-01-14" +XSTS_TARBALL_1="xsts-2002-01-16.tar.gz" +XSTS_TARBALL_2="xsts-2004-01-14.tar.gz" +XMLCONF_TARBALL="xmlts20080827.tar.gz" + +SRC_URI="ftp://xmlsoft.org/${PN}/${PN}-${PV/_rc/-rc}.tar.gz + test? ( + ${XSTS_HOME}/${XSTS_NAME_1}/${XSTS_TARBALL_1} + ${XSTS_HOME}/${XSTS_NAME_2}/${XSTS_TARBALL_2} + http://www.w3.org/XML/Test/${XMLCONF_TARBALL} )" + +COMMON_DEPEND=" + >=sys-libs/zlib-1.2.8-r1:=[${MULTILIB_USEDEP}] + icu? ( >=dev-libs/icu-51.2-r1:=[${MULTILIB_USEDEP}] ) + lzma? ( >=app-arch/xz-utils-5.0.5-r1:=[${MULTILIB_USEDEP}] ) + python? ( ${PYTHON_DEPS} ) + readline? ( sys-libs/readline:= ) +" +RDEPEND="${COMMON_DEPEND} + abi_x86_32? ( !<=app-emulation/emul-linux-x86-baselibs-20131008-r6 + !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)] ) +" +DEPEND="${COMMON_DEPEND} + dev-util/gtk-doc-am + virtual/pkgconfig + hppa? ( >=sys-devel/binutils-2.15.92.0.2 ) +" + +S="${WORKDIR}/${PN}-${PV%_rc*}" + +MULTILIB_CHOST_TOOLS=( + /usr/bin/xml2-config +) + +src_unpack() { + # ${A} isn't used to avoid unpacking of test tarballs into $WORKDIR, + # as they are needed as tarballs in ${S}/xstc instead and not unpacked + unpack ${P/_rc/-rc}.tar.gz + cd "${S}" + + if use test; then + cp "${DISTDIR}/${XSTS_TARBALL_1}" \ + "${DISTDIR}/${XSTS_TARBALL_2}" \ + "${S}"/xstc/ \ + || die "Failed to install test tarballs" + unpack ${XMLCONF_TARBALL} + fi +} + +src_prepare() { + DOCS=( AUTHORS ChangeLog NEWS README* TODO* ) + + # Patches needed for prefix support + epatch "${FILESDIR}"/${PN}-2.7.1-catalog_path.patch + epatch "${FILESDIR}"/${PN}-2.8.0_rc1-winnt.patch + + eprefixify catalog.c xmlcatalog.c runtest.c xmllint.c + +# epunt_cxx # if we don't eautoreconf + + epatch "${FILESDIR}"/${PN}-2.9.2-cross-compile.patch + + # Important patches from master + epatch \ + "${FILESDIR}/${PN}-2.9.2-revert-missing-initialization.patch" \ + "${FILESDIR}/${PN}-2.9.2-missing-entities.patch" \ + "${FILESDIR}/${PN}-2.9.2-threads-declarations.patch" \ + "${FILESDIR}/${PN}-2.9.2-timsort.patch" \ + "${FILESDIR}/${PN}-2.9.2-constant-memory.patch" + + # Please do not remove, as else we get references to PORTAGE_TMPDIR + # in /usr/lib/python?.?/site-packages/libxml2mod.la among things. + # We now need to run eautoreconf at the end to prevent maintainer mode. +# elibtoolize + + # Use pkgconfig to find icu to properly support multilib, upstream bug #738751 + epatch "${FILESDIR}/${PN}-2.9.2-icu-pkgconfig.patch" + + eautoreconf +} + +multilib_src_configure() { + # filter seemingly problematic CFLAGS (#26320) + filter-flags -fprefetch-loop-arrays -funroll-loops + + # USE zlib support breaks gnome2 + # (libgnomeprint for instance fails to compile with + # fresh install, and existing) - <azarah@gentoo.org> (22 Dec 2002). + + # The meaning of the 'debug' USE flag does not apply to the --with-debug + # switch (enabling the libxml2 debug module). See bug #100898. + + # --with-mem-debug causes unusual segmentation faults (bug #105120). + + libxml2_configure() { + ECONF_SOURCE="${S}" econf \ + --with-html-subdir=${PF}/html \ + --docdir="${EPREFIX}/usr/share/doc/${PF}" \ + $(use_with debug run-debug) \ + $(use_with icu) \ + $(use_with lzma) \ + $(use_enable ipv6) \ + $(use_enable static-libs static) \ + $(multilib_native_use_with readline) \ + $(multilib_native_use_with readline history) \ + "$@" + } + + libxml2_py_configure() { + mkdir -p "${BUILD_DIR}" || die # ensure python build dirs exist + run_in_build_dir libxml2_configure "--with-python=${PYTHON}" # odd build system + } + + libxml2_configure --without-python # build python bindings separately + + if multilib_is_native_abi && use python; then + python_foreach_impl libxml2_py_configure + fi +} + +multilib_src_compile() { + default + if multilib_is_native_abi && use python; then + local native_builddir=${BUILD_DIR} + python_foreach_impl libxml2_py_emake top_builddir="${native_builddir}" all + fi +} + +multilib_src_test() { + default + multilib_is_native_abi && use python && python_foreach_impl libxml2_py_emake test +} + +multilib_src_install() { + emake DESTDIR="${D}" \ + EXAMPLES_DIR="${EPREFIX}"/usr/share/doc/${PF}/examples install + + if multilib_is_native_abi && use python; then + python_foreach_impl libxml2_py_emake DESTDIR="${D}" install + python_foreach_impl python_optimize + fi +} + +multilib_src_install_all() { + # on windows, xmllint is installed by interix libxml2 in parent prefix. + # this is the version to use. the native winnt version does not support + # symlinks, which makes repoman fail if the portage tree is linked in + # from another location (which is my default). -- mduft + if [[ ${CHOST} == *-winnt* ]]; then + rm -rf "${ED}"/usr/bin/xmllint + rm -rf "${ED}"/usr/bin/xmlcatalog + fi + + rm -rf "${ED}"/usr/share/doc/${P} + einstalldocs + + if ! use python; then + rm -rf "${ED}"/usr/share/doc/${PF}/python + rm -rf "${ED}"/usr/share/doc/${PN}-python-${PV} + fi + + if ! use examples; then + rm -rf "${ED}/usr/share/doc/${PF}/examples" + rm -rf "${ED}/usr/share/doc/${PF}/python/examples" + fi + + prune_libtool_files --modules +} + +pkg_postinst() { + # We don't want to do the xmlcatalog during stage1, as xmlcatalog will not + # be in / and stage1 builds to ROOT=/tmp/stage1root. This fixes bug #208887. + if [[ "${ROOT}" != "/" ]]; then + elog "Skipping XML catalog creation for stage building (bug #208887)." + else + # need an XML catalog, so no-one writes to a non-existent one + CATALOG="${EROOT}etc/xml/catalog" + + # we dont want to clobber an existing catalog though, + # only ensure that one is there + # <obz@gentoo.org> + if [[ ! -e ${CATALOG} ]]; then + [[ -d "${EROOT}etc/xml" ]] || mkdir -p "${EROOT}etc/xml" + "${EPREFIX}"/usr/bin/xmlcatalog --create > "${CATALOG}" + einfo "Created XML catalog in ${CATALOG}" + fi + fi +} + +libxml2_py_emake() { + pushd "${BUILD_DIR}/python" > /dev/null || die + emake "$@" + popd > /dev/null +} diff --git a/dev-libs/libxml2/metadata.xml b/dev-libs/libxml2/metadata.xml new file mode 100644 index 000000000000..1c0594f6dd9d --- /dev/null +++ b/dev-libs/libxml2/metadata.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> +<herd>gnome</herd> +<upstream> + <remote-id type="cpe">cpe:/a:xmlsoft:libxml2</remote-id> +</upstream> +</pkgmetadata> |