7184322 libxml2 should pass its internal test suite
authorPetr Sumbera <petr.sumbera@oracle.com>
Mon, 16 Jul 2012 14:07:33 -0700
changeset 918 35e4a56e4a26
parent 917 c2d902bbacc9
child 919 a629aca6cb88
7184322 libxml2 should pass its internal test suite
components/libxml2/Makefile
components/libxml2/patches/20.EBCDIC.patch
components/libxml2/patches/21.runtest.patch
components/libxml2/patches/22.htmlSetMetaEncoding.patch
components/libxml2/patches/23.xpathleak.patch
--- a/components/libxml2/Makefile	Mon Jul 16 11:15:50 2012 -0700
+++ b/components/libxml2/Makefile	Mon Jul 16 14:07:33 2012 -0700
@@ -34,6 +34,12 @@
     sha256:238c4f0203c012e5776522640c0fb3ac532c4064981c1ce3e74c00b75501d761
 COMPONENT_ARCHIVE_URL=	ftp://xmlsoft.org/libxml2/$(COMPONENT_ARCHIVE)
 
+# W3C XML Conformance Test Suites
+COMPONENT_ARCHIVE_1= xmlts20080205.tar.gz
+COMPONENT_ARCHIVE_HASH_1= \
+    sha256:39ffe4a61be4187aac4b64b8fd34aa01bb004387527a1ec5dc9c8dd794a2562e
+COMPONENT_ARCHIVE_URL_1= http://www.w3.org/XML/Test/$(COMPONENT_ARCHIVE_1)
+
 include ../../make-rules/prep.mk
 include ../../make-rules/configure.mk
 include ../../make-rules/ips.mk
@@ -50,9 +56,11 @@
 CONFIGURE_OPTIONS += LDFLAGS="$(LDFLAGS)"
 CONFIGURE_OPTIONS += PYTHON_VENDOR_PACKAGES=$(PYTHON_VENDOR_PACKAGES)
 
+COMPONENT_PREP_ACTION =  (cd $(@D) ; gtar xf $(COMPONENT_DIR)/$(COMPONENT_ARCHIVE_1));
 COMPONENT_PREP_ACTION += (cd $(@D) ; cp ../mapfile libxml2.syms ; autoreconf -if)
 
-COMPONENT_TEST_TARGETS = tests
+# Internal test suit needs data files ready.
+COMPONENT_PRE_CONFIGURE_ACTION = ($(CLONEY) $(SOURCE_DIR) $(@D))
 
 # After we have configured, make a copy of the python bits so we
 # can build separate python 2.7 support.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/libxml2/patches/20.EBCDIC.patch	Mon Jul 16 14:07:33 2012 -0700
@@ -0,0 +1,11 @@
+--- libxml2-2.7.6/encoding.c
++++ libxml2-2.7.6/encoding.c
+@@ -1460,6 +1460,8 @@
+             if (handler != NULL) return(handler);
+             handler = xmlFindCharEncodingHandler("EBCDIC-US");
+             if (handler != NULL) return(handler);
++            handler = xmlFindCharEncodingHandler("IBM-037");
++            if (handler != NULL) return(handler);
+ 	    break;
+         case XML_CHAR_ENCODING_UCS4BE:
+             handler = xmlFindCharEncodingHandler("ISO-10646-UCS-4");
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/libxml2/patches/21.runtest.patch	Mon Jul 16 14:07:33 2012 -0700
@@ -0,0 +1,24 @@
+From c966790781a9ab5d80aed1246df6316149ef5f07 Mon Sep 17 00:00:00 2001
+From: Rob Richards <[email protected]>
+Date: Fri, 22 Jan 2010 13:24:25 +0000
+Subject: Fix relaxNG tests in runtest for Windows
+
+* runtest.c: initialize ret
+---
+(limited to 'runtest.c')
+
+diff --git a/runtest.c b/runtest.c
+index 16196ea..fa925c1 100644
+--- a/runtest.c
++++ b/runtest.c
+@@ -3165,7 +3165,7 @@ rngTest(const char *filename,
+     const char *instance;
+     xmlRelaxNGParserCtxtPtr ctxt;
+     xmlRelaxNGPtr schemas;
+-    int res = 0, len, ret;
++    int res = 0, len, ret = 0;
+     char pattern[500];
+     char prefix[500];
+     char result[500];
+--
+cgit v0.9.0.2
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/libxml2/patches/22.htmlSetMetaEncoding.patch	Mon Jul 16 14:07:33 2012 -0700
@@ -0,0 +1,83 @@
+Last file (tree.c) of original commit was left out since it modifies
+just comment where it wouldn't apply because of change in context.
+
+From 39d027cdb74371d64f68dc488556be41e1d14546 Mon Sep 17 00:00:00 2001
+From: Daniel Veillard <[email protected]>
+Date: Fri, 11 May 2012 04:38:23 +0000
+Subject: Fix html serialization error and htmlSetMetaEncoding()
+
+For https://bugzilla.gnome.org/show_bug.cgi?id=630682
+The python tests were reporting errors, some of it was due to
+a small change in case encoding, but the main one was about
+htmlSetMetaEncoding(doc, NULL) being broken by not removing
+the associated meta tag anymore
+---
+diff --git a/HTMLtree.c b/HTMLtree.c
+index f23ae02..5d0893b 100644
+--- a/HTMLtree.c
++++ b/HTMLtree.c
+@@ -151,7 +151,7 @@ found_content:
+  * htmlSetMetaEncoding:
+  * @doc:  the document
+  * @encoding:  the encoding string
+- * 
++ *
+  * Sets the current encoding in the Meta tags
+  * NOTE: this will not change the document content encoding, just
+  * the META flag associated.
+@@ -164,6 +164,7 @@ htmlSetMetaEncoding(htmlDocPtr doc, const xmlChar *encoding) {
+     const xmlChar *content = NULL;
+     char newcontent[100];
+ 
++    newcontent[0] = 0;
+ 
+     if (doc == NULL)
+ 	return(-1);
+@@ -244,7 +245,7 @@ found_meta:
+ 			    http = 1;
+ 			else
+                         {
+-                           if ((value != NULL) && 
++                           if ((value != NULL) &&
+                                (!xmlStrcasecmp(attr->name, BAD_CAST"content")))
+ 			       content = value;
+                         }
+@@ -278,8 +279,13 @@ create:
+             xmlNewProp(meta, BAD_CAST"content", BAD_CAST newcontent);
+         }
+     } else {
++        /* remove the meta tag if NULL is passed */
++        if (encoding == NULL) {
++            xmlUnlinkNode(meta);
++            xmlFreeNode(meta);
++        }
+         /* change the document only if there is a real encoding change */
+-        if (xmlStrcasestr(content, encoding) == NULL) {
++        else if (xmlStrcasestr(content, encoding) == NULL) {
+             xmlSetProp(meta, BAD_CAST"content", BAD_CAST newcontent);
+         }
+     }
+diff --git a/python/tests/serialize.py b/python/tests/serialize.py
+index 5b969a9..91753e7 100755
+--- a/python/tests/serialize.py
++++ b/python/tests/serialize.py
+@@ -96,7 +96,7 @@ str = doc.serialize("iso-8859-1", 1)
+ if str != """<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
+ <html>
+ <head>
+-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
++<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+ <title>Hello</title>
+ </head>
+ <body><p>hello</p></body>
+@@ -131,7 +131,7 @@ if str != """<html>
+ str = root.serialize("iso-8859-1", 1)
+ if str != """<html>
+ <head>
+-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
++<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+ <title>Hello</title>
+ </head>
+ <body><p>hello</p></body>
+--
+cgit v0.9.0.2
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/libxml2/patches/23.xpathleak.patch	Mon Jul 16 14:07:33 2012 -0700
@@ -0,0 +1,34 @@
+Second chunk of the patch was left out since it's already in 2.7.6 even
+according git history it was committed in one step.
+
+From 729601f15772c19778062b98bd0716d8f5c2af3b Mon Sep 17 00:00:00 2001
+From: Martin <[email protected]>
+Date: Mon, 12 Oct 2009 20:42:26 +0000
+Subject: Fix memory leak in xmlXPathEvalExpression()
+
+* xpath.c: plug some leaks when parsing misformed XPath expressions
+* python/tests/xpathleak.py: expand the regression tests for those
+---
+(limited to 'python/tests/xpathleak.py')
+
+diff --git a/python/tests/xpathleak.py b/python/tests/xpathleak.py
+index dcc144c..39f49e3 100644
+--- a/python/tests/xpathleak.py
++++ b/python/tests/xpathleak.py
+@@ -15,6 +15,14 @@ expect="""--> Invalid expression
+ --> xmlXPathEval: evaluation failed
+ --> Invalid expression
+ --> xmlXPathEval: evaluation failed
++--> Invalid expression
++--> xmlXPathEval: evaluation failed
++--> Invalid expression
++--> xmlXPathEval: evaluation failed
++--> Invalid expression
++--> xmlXPathEval: evaluation failed
++--> Invalid expression
++--> xmlXPathEval: evaluation failed
+ """
+ err=""
+ def callback(ctx, str):
+--
+cgit v0.9.0.2