Mon Mar 12 18:06:50 2012 UTC ()
Pullup ticket #3701 - requested by drochner
textproc/libxml2: security fix and HEAD compatibility

Revisions pulled up:
- textproc/libxml2/Makefile                                     1.113-1.114
- textproc/libxml2/distinfo                                     1.88-1.89
- textproc/libxml2/patches/patch-CVE-2012-0841-aa               1.1
- textproc/libxml2/patches/patch-CVE-2012-0841-ab               1.1
- textproc/libxml2/patches/patch-CVE-2012-0841-ac               1.1
- textproc/libxml2/patches/patch-aa                             1.24
- textproc/libxml2/patches/patch-ab                             1.22
- textproc/libxml2/patches/patch-am                             1.1

-------------------------------------------------------------------
   Module Name:    pkgsrc
   Committed By:   drochner
   Date:           Wed Feb 22 11:10:18 UTC 2012

   Modified Files:
           pkgsrc/textproc/libxml2: Makefile distinfo
           pkgsrc/textproc/libxml2/patches: patch-aa patch-ab
   Added Files:
           pkgsrc/textproc/libxml2/patches: patch-am

   Log Message:
   build the library thread-aware, i.e. use <pthread.h> but do not
   link against libpthread. (It doesn't create threads, just uses
   locking.) This seems to be wanted by some applications, eg vlc
   issues a warning on startup (with no visible consequences afaict,
   but anyway).
   I hope this works for other OSes too. If not, we should probably
   add support for these cases to mk/pthread.bl3.mk.
   bump PKGREV

   To generate a diff of this commit:
   cvs rdiff -u -r1.112 -r1.113 pkgsrc/textproc/libxml2/Makefile
   cvs rdiff -u -r1.87 -r1.88 pkgsrc/textproc/libxml2/distinfo
   cvs rdiff -u -r1.23 -r1.24 pkgsrc/textproc/libxml2/patches/patch-aa
   cvs rdiff -u -r1.21 -r1.22 pkgsrc/textproc/libxml2/patches/patch-ab
   cvs rdiff -u -r0 -r1.1 pkgsrc/textproc/libxml2/patches/patch-am

-------------------------------------------------------------------
   Module Name:    pkgsrc
   Committed By:   drochner
   Date:           Fri Mar  9 12:12:28 UTC 2012

   Modified Files:
           pkgsrc/textproc/libxml2: Makefile distinfo
   Added Files:
           pkgsrc/textproc/libxml2/patches: patch-CVE-2012-0841-aa
           patch-CVE-2012-0841-ab patch-CVE-2012-0841-ac

   Log Message:
   Add patch from upstream to add hash randomization.
   Without that, (untrusted) input can fill hash buckets uneven, causing
   high CPU load. (CVE-2012-0841)
   To get a patch which is simple enough to get pulled up to the stable
   pkgsrc branch, I've not touched "configure" but just assumed that
   the POSIX functions rand(), srand() and time() are present.
   bump PKGREV

   To generate a diff of this commit:
   cvs rdiff -u -r1.113 -r1.114 pkgsrc/textproc/libxml2/Makefile
   cvs rdiff -u -r1.88 -r1.89 pkgsrc/textproc/libxml2/distinfo
   cvs rdiff -u -r0 -r1.1 pkgsrc/textproc/libxml2/patches/patch-CVE-2012-0841-aa \
       pkgsrc/textproc/libxml2/patches/patch-CVE-2012-0841-ab \
       pkgsrc/textproc/libxml2/patches/patch-CVE-2012-0841-ac


(spz)
diff -r1.110.2.2 -r1.110.2.3 pkgsrc/textproc/libxml2/Makefile
diff -r1.84.2.2 -r1.84.2.3 pkgsrc/textproc/libxml2/distinfo
diff -r0 -r1.1.2.2 pkgsrc/textproc/libxml2/patches/patch-CVE-2012-0841-aa
diff -r0 -r1.1.2.2 pkgsrc/textproc/libxml2/patches/patch-CVE-2012-0841-ab
diff -r0 -r1.1.2.2 pkgsrc/textproc/libxml2/patches/patch-CVE-2012-0841-ac
diff -r0 -r1.1.2.2 pkgsrc/textproc/libxml2/patches/patch-am
diff -r1.23 -r1.23.30.1 pkgsrc/textproc/libxml2/patches/patch-aa
diff -r1.21 -r1.21.10.1 pkgsrc/textproc/libxml2/patches/patch-ab

cvs diff -r1.110.2.2 -r1.110.2.3 pkgsrc/textproc/libxml2/Makefile (expand / switch to unified diff)

--- pkgsrc/textproc/libxml2/Makefile 2012/01/19 06:07:36 1.110.2.2
+++ pkgsrc/textproc/libxml2/Makefile 2012/03/12 18:06:49 1.110.2.3
@@ -1,50 +1,55 @@ @@ -1,50 +1,55 @@
1# $NetBSD: Makefile,v 1.110.2.2 2012/01/19 06:07:36 sbd Exp $ 1# $NetBSD: Makefile,v 1.110.2.3 2012/03/12 18:06:49 spz Exp $
2 2
3DISTNAME= libxml2-2.7.8 3DISTNAME= libxml2-2.7.8
4PKGREVISION= 6 4PKGREVISION= 8
5CATEGORIES= textproc 5CATEGORIES= textproc
6MASTER_SITES= ftp://xmlsoft.org/libxml2/ \ 6MASTER_SITES= ftp://xmlsoft.org/libxml2/ \
7 http://xmlsoft.org/sources/ 7 http://xmlsoft.org/sources/
8#MASTER_SITES= ${MASTER_SITE_GNOME:=sources/libxml2/2.7/} 8#MASTER_SITES= ${MASTER_SITE_GNOME:=sources/libxml2/2.7/}
9 9
10MAINTAINER= pkgsrc-users@NetBSD.org 10MAINTAINER= pkgsrc-users@NetBSD.org
11HOMEPAGE= http://xmlsoft.org/ 11HOMEPAGE= http://xmlsoft.org/
12COMMENT= XML parser library from the GNOME project 12COMMENT= XML parser library from the GNOME project
13LICENSE= modified-bsd 13LICENSE= modified-bsd
14 14
15PKG_INSTALLATION_TYPES= overwrite pkgviews 15PKG_INSTALLATION_TYPES= overwrite pkgviews
16PKG_DESTDIR_SUPPORT= user-destdir 16PKG_DESTDIR_SUPPORT= user-destdir
17 17
18USE_TOOLS+= gmake 18USE_TOOLS+= gmake
19USE_FEATURES= glob 19USE_FEATURES= glob
20USE_LIBTOOL= yes 20USE_LIBTOOL= yes
21PKGCONFIG_OVERRIDE= libxml-2.0.pc.in 21PKGCONFIG_OVERRIDE= libxml-2.0.pc.in
22 22
23GNU_CONFIGURE= yes 23GNU_CONFIGURE= yes
24CONFIGURE_ARGS+= --with-iconv=${BUILDLINK_PREFIX.iconv} 24CONFIGURE_ARGS+= --with-iconv=${BUILDLINK_PREFIX.iconv}
25CONFIGURE_ARGS+= --with-html-subdir=libxml2 25CONFIGURE_ARGS+= --with-html-subdir=libxml2
26CONFIGURE_ARGS+= --without-python 26CONFIGURE_ARGS+= --without-python
27 27
28.include "options.mk" 28.include "options.mk"
29 29
30# Don't use threads - it's not apparent whether it's necessary or not, 30# allow thread-awareness, but make sure the library is not
31# and this library needs to be usable by non-threaded applications too 31# linked against libpthread
32CONFIGURE_ARGS+= --without-threads 32#CONFIGURE_ARGS+= --without-threads
33 33
34MAKE_ENV+= PAX=${PAX:Q} 34MAKE_ENV+= PAX=${PAX:Q}
35 35
36.include "../../mk/bsd.prefs.mk" 36.include "../../mk/bsd.prefs.mk"
37 37
38TEST_TARGET= check 38TEST_TARGET= check
39 39
40SUBST_CLASSES+= cat 40SUBST_CLASSES+= cat
41SUBST_STAGE.cat= pre-configure 41SUBST_STAGE.cat= pre-configure
42SUBST_FILES.cat= catalog.c xmlcatalog.c 42SUBST_FILES.cat= catalog.c xmlcatalog.c
43SUBST_SED.cat= -e "s,@@SGML_DEFAULT_CATALOG@@,${SGML_DEFAULT_CATALOG},g" 43SUBST_SED.cat= -e "s,@@SGML_DEFAULT_CATALOG@@,${SGML_DEFAULT_CATALOG},g"
44SUBST_SED.cat+= -e "s,@@XML_DEFAULT_CATALOG@@,${XML_DEFAULT_CATALOG},g" 44SUBST_SED.cat+= -e "s,@@XML_DEFAULT_CATALOG@@,${XML_DEFAULT_CATALOG},g"
45 45
 46# XXX make sure the library is not linked against libpthread
 47post-install:
 48 test -z "`ldd ${DESTDIR}${PREFIX}/lib/libxml2.so | grep pthread`"
 49
 50.include "../../mk/pthread.buildlink3.mk"
46.include "../../devel/zlib/buildlink3.mk" 51.include "../../devel/zlib/buildlink3.mk"
47.include "../../converters/libiconv/buildlink3.mk" 52.include "../../converters/libiconv/buildlink3.mk"
48.include "../../textproc/xmlcatmgr/catalogs.mk" 53.include "../../textproc/xmlcatmgr/catalogs.mk"
49 54
50.include "../../mk/bsd.pkg.mk" 55.include "../../mk/bsd.pkg.mk"

cvs diff -r1.84.2.2 -r1.84.2.3 pkgsrc/textproc/libxml2/distinfo (expand / switch to unified diff)

--- pkgsrc/textproc/libxml2/distinfo 2012/01/19 06:07:36 1.84.2.2
+++ pkgsrc/textproc/libxml2/distinfo 2012/03/12 18:06:49 1.84.2.3
@@ -1,16 +1,20 @@ @@ -1,16 +1,20 @@
1$NetBSD: distinfo,v 1.84.2.2 2012/01/19 06:07:36 sbd Exp $ 1$NetBSD: distinfo,v 1.84.2.3 2012/03/12 18:06:49 spz Exp $
2 2
3SHA1 (libxml2-2.7.8.tar.gz) = 859dd535edbb851cc15b64740ee06551a7a17d40 3SHA1 (libxml2-2.7.8.tar.gz) = 859dd535edbb851cc15b64740ee06551a7a17d40
4RMD160 (libxml2-2.7.8.tar.gz) = 30709622cfe3e2175e73d6701b7e19a25ab5ac47 4RMD160 (libxml2-2.7.8.tar.gz) = 30709622cfe3e2175e73d6701b7e19a25ab5ac47
5Size (libxml2-2.7.8.tar.gz) = 4881808 bytes 5Size (libxml2-2.7.8.tar.gz) = 4881808 bytes
6SHA1 (patch-aa) = bf7db00ddf8a36394521baf656cf83d99bd9cbd3 6SHA1 (patch-CVE-2012-0841-aa) = b5fcb53c69ab808aafbaa81e9a4bef3f69057ff8
7SHA1 (patch-ab) = e1cb25ae1b2219af91d11f0ccdbb12912d50488a 7SHA1 (patch-CVE-2012-0841-ab) = 2fd0d1a610bc517c4062f5ba30ec546d153eb5a1
 8SHA1 (patch-CVE-2012-0841-ac) = 3ee79a6ecaf498ae0db4f64a10e22cc3e515e1e3
 9SHA1 (patch-aa) = 965bfc2226828b5161a4541cf73f5b5ef9a7e88e
 10SHA1 (patch-ab) = d8dfd5bd9632d32c7e32e35e4d4735e510fc438f
8SHA1 (patch-ac) = 264c75cf9fff5319105b971c122cdf5fc103c04e 11SHA1 (patch-ac) = 264c75cf9fff5319105b971c122cdf5fc103c04e
9SHA1 (patch-ad) = cd45da492b02cce9983c46762839f68b8b1e0177 12SHA1 (patch-ad) = cd45da492b02cce9983c46762839f68b8b1e0177
10SHA1 (patch-ae) = b8d8e0275cab3caafd98275ac22b63951fc4b5fd 13SHA1 (patch-ae) = b8d8e0275cab3caafd98275ac22b63951fc4b5fd
11SHA1 (patch-ag) = ab4aeeb8ca696b88285274760ab3ef08800773a0 14SHA1 (patch-ag) = ab4aeeb8ca696b88285274760ab3ef08800773a0
12SHA1 (patch-aj) = 24eb4a08ea4c40be6d75a72cd0bb5280514f73d4 15SHA1 (patch-aj) = 24eb4a08ea4c40be6d75a72cd0bb5280514f73d4
13SHA1 (patch-ak) = 5e0e9807d7ae0bc93a5583a61bb88a49ec1751e8 16SHA1 (patch-ak) = 5e0e9807d7ae0bc93a5583a61bb88a49ec1751e8
14SHA1 (patch-al) = 45f984fef5cf5d04c46e940867707897396a9c9f 17SHA1 (patch-al) = 45f984fef5cf5d04c46e940867707897396a9c9f
 18SHA1 (patch-am) = ae7ab69b7bba2271d2d996161cc8b9956d0b06fa
15SHA1 (patch-include_libxml_xpath.h) = 3fc74551a7843668cf9ffee19b1f20ccb674e153 19SHA1 (patch-include_libxml_xpath.h) = 3fc74551a7843668cf9ffee19b1f20ccb674e153
16SHA1 (patch-xpointer.c) = fa720fd515bab3f99bb11bf56320b3ad8e5fb211 20SHA1 (patch-xpointer.c) = fa720fd515bab3f99bb11bf56320b3ad8e5fb211

File Added: pkgsrc/textproc/libxml2/patches/Attic/patch-CVE-2012-0841-aa
$NetBSD: patch-CVE-2012-0841-aa,v 1.1.2.2 2012/03/12 18:06:49 spz Exp $

patch 8973d58b7498fa5100a876815476b81fd1a2412a

--- dict.c.orig	2010-10-12 06:25:31.000000000 +0000
+++ dict.c
@@ -2,7 +2,7 @@
  * dict.c: dictionary of reusable strings, just used to avoid allocation
  *         and freeing operations.
  *
- * Copyright (C) 2003 Daniel Veillard.
+ * Copyright (C) 2003-2012 Daniel Veillard.
  *
  * Permission to use, copy, modify, and distribute this software for any
  * purpose with or without fee is hereby granted, provided that the above
@@ -19,6 +19,28 @@
 #define IN_LIBXML
 #include "libxml.h"
 
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#ifdef HAVE_TIME_H
+#include <time.h>
+#endif
+
+/*
+ * Following http://www.ocert.org/advisories/ocert-2011-003.html
+ * it seems that having hash randomization might be a good idea
+ * when using XML with untrusted data
+ * Note1: that it works correctly only if compiled with WITH_BIG_KEY
+ *  which is the default.
+ * Note2: the fast function used for a small dict won't protect very
+ *  well but since the attack is based on growing a very big hash
+ *  list we will use the BigKey algo as soon as the hash size grows
+ *  over MIN_DICT_SIZE so this actually works
+ */
+#if defined(HAVE_RAND) && defined(HAVE_SRAND) && defined(HAVE_TIME)
+#define DICT_RANDOMIZATION
+#endif
+
 #include <string.h>
 #ifdef HAVE_STDINT_H
 #include <stdint.h>
@@ -44,23 +66,23 @@ typedef unsigned __int32 uint32_t;
 #define WITH_BIG_KEY
 
 #ifdef WITH_BIG_KEY
-#define xmlDictComputeKey(dict, name, len)			\
-    (((dict)->size == MIN_DICT_SIZE) ?				\
-     xmlDictComputeFastKey(name, len) :				\
-     xmlDictComputeBigKey(name, len))
-
-#define xmlDictComputeQKey(dict, prefix, plen, name, len)	\
-    (((prefix) == NULL) ?					\
-      (xmlDictComputeKey(dict, name, len)) :			\
-      (((dict)->size == MIN_DICT_SIZE) ?			\
-       xmlDictComputeFastQKey(prefix, plen, name, len) :	\
-       xmlDictComputeBigQKey(prefix, plen, name, len)))
+#define xmlDictComputeKey(dict, name, len)                              \
+    (((dict)->size == MIN_DICT_SIZE) ?                                  \
+     xmlDictComputeFastKey(name, len, (dict)->seed) :                   \
+     xmlDictComputeBigKey(name, len, (dict)->seed))
+
+#define xmlDictComputeQKey(dict, prefix, plen, name, len)               \
+    (((prefix) == NULL) ?                                               \
+      (xmlDictComputeKey(dict, name, len)) :                             \
+      (((dict)->size == MIN_DICT_SIZE) ?                                \
+       xmlDictComputeFastQKey(prefix, plen, name, len, (dict)->seed) :	\
+       xmlDictComputeBigQKey(prefix, plen, name, len, (dict)->seed)))
 
 #else /* !WITH_BIG_KEY */
-#define xmlDictComputeKey(dict, name, len)			\
-        xmlDictComputeFastKey(name, len)
-#define xmlDictComputeQKey(dict, prefix, plen, name, len)	\
-        xmlDictComputeFastQKey(prefix, plen, name, len)
+#define xmlDictComputeKey(dict, name, len)                              \
+        xmlDictComputeFastKey(name, len, (dict)->seed)
+#define xmlDictComputeQKey(dict, prefix, plen, name, len)               \
+        xmlDictComputeFastQKey(prefix, plen, name, len, (dict)->seed)
 #endif /* WITH_BIG_KEY */
 
 /*
@@ -98,6 +120,8 @@ struct _xmlDict {
     xmlDictStringsPtr strings;
 
     struct _xmlDict *subdict;
+    /* used for randomization */
+    int seed;
 };
 
 /*
@@ -125,6 +149,9 @@ static int xmlInitializeDict(void) {
     if ((xmlDictMutex = xmlNewRMutex()) == NULL)
         return(0);
 
+#ifdef DICT_RANDOMIZATION
+    srand(time(NULL));
+#endif
     xmlDictInitialized = 1;
     return(1);
 }
@@ -277,13 +304,13 @@ found_pool:
  */
 
 static uint32_t
-xmlDictComputeBigKey(const xmlChar* data, int namelen) {
+xmlDictComputeBigKey(const xmlChar* data, int namelen, int seed) {
     uint32_t hash;
     int i;
 
     if (namelen <= 0 || data == NULL) return(0);
 
-    hash = 0;
+    hash = seed;
 
     for (i = 0;i < namelen; i++) {
         hash += data[i];
@@ -310,12 +337,12 @@ xmlDictComputeBigKey(const xmlChar* data
  */
 static unsigned long
 xmlDictComputeBigQKey(const xmlChar *prefix, int plen,
-                      const xmlChar *name, int len)
+                      const xmlChar *name, int len, int seed)
 {
     uint32_t hash;
     int i;
 
-    hash = 0;
+    hash = seed;
 
     for (i = 0;i < plen; i++) {
         hash += prefix[i];
@@ -346,8 +373,8 @@ xmlDictComputeBigQKey(const xmlChar *pre
  * for low hash table fill.
  */
 static unsigned long
-xmlDictComputeFastKey(const xmlChar *name, int namelen) {
-    unsigned long value = 0L;
+xmlDictComputeFastKey(const xmlChar *name, int namelen, int seed) {
+    unsigned long value = seed;
 
     if (name == NULL) return(0);
     value = *name;
@@ -381,9 +408,9 @@ xmlDictComputeFastKey(const xmlChar *nam
  */
 static unsigned long
 xmlDictComputeFastQKey(const xmlChar *prefix, int plen,
-                       const xmlChar *name, int len)
+                       const xmlChar *name, int len, int seed)
 {
-    unsigned long value = 0L;
+    unsigned long value = (unsigned long) seed;
 
     if (plen == 0)
 	value += 30 * (unsigned long) ':';
@@ -460,6 +487,11 @@ xmlDictCreate(void) {
 	dict->subdict = NULL;
         if (dict->dict) {
 	    memset(dict->dict, 0, MIN_DICT_SIZE * sizeof(xmlDictEntry));
+#ifdef DICT_RANDOMIZATION
+            dict->seed = rand();
+#else
+            dict->seed = 0;
+#endif
 	    return(dict);
         }
         xmlFree(dict);
@@ -486,6 +518,7 @@ xmlDictCreateSub(xmlDictPtr sub) {
 #ifdef DICT_DEBUG_PATTERNS
         fprintf(stderr, "R");
 #endif
+        dict->seed = sub->seed;
         dict->subdict = sub;
 	xmlDictReference(dict->subdict);
     }

File Added: pkgsrc/textproc/libxml2/patches/Attic/patch-CVE-2012-0841-ab
$NetBSD: patch-CVE-2012-0841-ab,v 1.1.2.2 2012/03/12 18:06:49 spz Exp $

patch 8973d58b7498fa5100a876815476b81fd1a2412a

--- hash.c.orig	2010-10-12 06:25:32.000000000 +0000
+++ hash.c
@@ -3,7 +3,7 @@
  *
  * Reference: Your favorite introductory book on algorithms
  *
- * Copyright (C) 2000 Bjorn Reese and Daniel Veillard.
+ * Copyright (C) 2000,2012 Bjorn Reese and Daniel Veillard.
  *
  * Permission to use, copy, modify, and distribute this software for any
  * purpose with or without fee is hereby granted, provided that the above
@@ -21,6 +21,22 @@
 #include "libxml.h"
 
 #include <string.h>
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#ifdef HAVE_TIME_H
+#include <time.h>
+#endif
+
+/*
+ * Following http://www.ocert.org/advisories/ocert-2011-003.html
+ * it seems that having hash randomization might be a good idea
+ * when using XML with untrusted data
+ */
+#if defined(HAVE_RAND) && defined(HAVE_SRAND) && defined(HAVE_TIME)
+#define HASH_RANDOMIZATION
+#endif
+
 #include <libxml/parser.h>
 #include <libxml/hash.h>
 #include <libxml/xmlmemory.h>
@@ -31,6 +47,10 @@
 
 /* #define DEBUG_GROW */
 
+#ifdef HASH_RANDOMIZATION
+static int hash_initialized = 0;
+#endif
+
 /*
  * A single entry in the hash table
  */
@@ -53,6 +73,9 @@ struct _xmlHashTable {
     int size;
     int nbElems;
     xmlDictPtr dict;
+#ifdef HASH_RANDOMIZATION
+    int random_seed;
+#endif
 };
 
 /*
@@ -65,6 +88,9 @@ xmlHashComputeKey(xmlHashTablePtr table,
     unsigned long value = 0L;
     char ch;
     
+#ifdef HASH_RANDOMIZATION
+    value = table->random_seed;
+#endif
     if (name != NULL) {
 	value += 30 * (*name);
 	while ((ch = *name++) != 0) {
@@ -92,6 +118,9 @@ xmlHashComputeQKey(xmlHashTablePtr table
     unsigned long value = 0L;
     char ch;
     
+#ifdef HASH_RANDOMIZATION
+    value = table->random_seed;
+#endif
     if (prefix != NULL)
 	value += 30 * (*prefix);
     else
@@ -156,6 +185,13 @@ xmlHashCreate(int size) {
         table->table = xmlMalloc(size * sizeof(xmlHashEntry));
         if (table->table) {
   	    memset(table->table, 0, size * sizeof(xmlHashEntry));
+#ifdef HASH_RANDOMIZATION
+            if (!hash_initialized) {
+                srand(time(NULL));
+                hash_initialized = 1;
+            }
+            table->random_seed = rand();
+#endif
   	    return(table);
         }
         xmlFree(table);

File Added: pkgsrc/textproc/libxml2/patches/Attic/patch-CVE-2012-0841-ac
$NetBSD: patch-CVE-2012-0841-ac,v 1.1.2.2 2012/03/12 18:06:50 spz Exp $

avoid to modify "configure", to keep the patch simple

--- config.h.in.orig	2010-11-04 17:28:15.000000000 +0000
+++ config.h.in
@@ -309,3 +309,8 @@
 
 /* Win32 Std C name mangling work-around */
 #undef vsnprintf
+
+/* XXX assume that POSIX functions are present */
+#define HAVE_RAND 1
+#define HAVE_SRAND 1
+#define HAVE_TIME 1

File Added: pkgsrc/textproc/libxml2/patches/Attic/patch-am
$NetBSD: patch-am,v 1.1.2.2 2012/03/12 18:06:50 spz Exp $

--- runtest.c.orig	2010-10-12 06:25:32.000000000 +0000
+++ runtest.c
@@ -3936,7 +3936,7 @@ thread_specific_data(void *private_data)
     return ((void *) Okay);
 }
 
-#if defined(linux) || defined(__sun) || defined(__APPLE_CC__)
+#if defined(linux) || defined(__sun) || defined(__APPLE_CC__) || defined(__NetBSD__)
 
 #include <pthread.h>
 

cvs diff -r1.23 -r1.23.30.1 pkgsrc/textproc/libxml2/patches/Attic/patch-aa (expand / switch to unified diff)

--- pkgsrc/textproc/libxml2/patches/Attic/patch-aa 2008/09/06 14:58:34 1.23
+++ pkgsrc/textproc/libxml2/patches/Attic/patch-aa 2012/03/12 18:06:50 1.23.30.1
@@ -1,13 +1,22 @@ @@ -1,13 +1,22 @@
1$NetBSD: patch-aa,v 1.23 2008/09/06 14:58:34 wiz Exp $ 1$NetBSD: patch-aa,v 1.23.30.1 2012/03/12 18:06:50 spz Exp $
2 2
3--- Makefile.in.orig 2008-08-30 16:50:47.000000000 +0200 3--- Makefile.in.orig 2010-11-04 17:28:16.000000000 +0000
4+++ Makefile.in 4+++ Makefile.in
5@@ -657,7 +657,7 @@ pkgconfig_DATA = libxml-2.0.pc 5@@ -569,7 +569,7 @@ DIST_SUBDIRS = include . doc example pyt
 6 INCLUDES = -I$(top_builddir)/include -I@srcdir@/include @THREAD_CFLAGS@ @Z_CFLAGS@
 7 bin_SCRIPTS = xml2-config
 8 lib_LTLIBRARIES = libxml2.la
 9-libxml2_la_LIBADD = @THREAD_LIBS@ @Z_LIBS@ $(ICONV_LIBS) @M_LIBS@ @WIN32_EXTRA_LIBADD@
 10+libxml2_la_LIBADD = @Z_LIBS@ $(ICONV_LIBS) @M_LIBS@ @WIN32_EXTRA_LIBADD@
 11 @USE_VERSION_SCRIPT_FALSE@LIBXML2_VERSION_SCRIPT =
 12 @USE_VERSION_SCRIPT_TRUE@LIBXML2_VERSION_SCRIPT = $(VERSION_SCRIPT_FLAGS)$(srcdir)/libxml2.syms
 13 libxml2_la_LDFLAGS = @CYGWIN_EXTRA_LDFLAGS@ @WIN32_EXTRA_LDFLAGS@ \
 14@@ -714,7 +714,7 @@ pkgconfig_DATA = libxml-2.0.pc
6 # 15 #
7 BASE_DIR = $(datadir)/doc 16 BASE_DIR = $(datadir)/doc
8 DOC_MODULE = libxml2-$(VERSION) 17 DOC_MODULE = libxml2-$(VERSION)
9-EXAMPLES_DIR = $(BASE_DIR)/$(DOC_MODULE)/examples 18-EXAMPLES_DIR = $(BASE_DIR)/$(DOC_MODULE)/examples
10+EXAMPLES_DIR = $(datadir)/examples/libxml2 19+EXAMPLES_DIR = $(datadir)/examples/libxml2
11  20
12 # 21 #
13 # Coverage support, largely borrowed from libvirt 22 # Coverage support, largely borrowed from libvirt

cvs diff -r1.21 -r1.21.10.1 pkgsrc/textproc/libxml2/patches/Attic/patch-ab (expand / switch to unified diff)

--- pkgsrc/textproc/libxml2/patches/Attic/patch-ab 2010/11/26 13:43:25 1.21
+++ pkgsrc/textproc/libxml2/patches/Attic/patch-ab 2012/03/12 18:06:50 1.21.10.1
@@ -1,35 +1,61 @@ @@ -1,35 +1,61 @@
1$NetBSD: patch-ab,v 1.21 2010/11/26 13:43:25 drochner Exp $ 1$NetBSD: patch-ab,v 1.21.10.1 2012/03/12 18:06:50 spz Exp $
2 2
3--- configure.orig 2010-11-04 17:28:14.000000000 +0000 3--- configure.orig 2010-11-04 17:28:14.000000000 +0000
4+++ configure 4+++ configure
5@@ -11414,7 +11414,7 @@ else 5@@ -11414,7 +11414,7 @@ else
6 esac 6 esac
7 fi 7 fi
8  8
9- if test -z "$VERSION_SCRIPT_FLAGS"; then 9- if test -z "$VERSION_SCRIPT_FLAGS"; then
10+ if test \! -z "$VERSION_SCRIPT_FLAGS"; then 10+ if test \! -z "$VERSION_SCRIPT_FLAGS"; then
11 USE_VERSION_SCRIPT_TRUE= 11 USE_VERSION_SCRIPT_TRUE=
12 USE_VERSION_SCRIPT_FALSE='#' 12 USE_VERSION_SCRIPT_FALSE='#'
13 else 13 else
14@@ -13364,7 +13364,7 @@ fi 14@@ -13364,7 +13364,7 @@ fi
15 fi 15 fi
16  16
17  17
18-XML_LIBDIR='-L${libdir}' 18-XML_LIBDIR='-L${libdir}'
19+XML_LIBDIR='-Wl,-R${libdir} -L${libdir}' 19+XML_LIBDIR='-Wl,-R${libdir} -L${libdir}'
20 XML_INCLUDEDIR='-I${includedir}/libxml2' 20 XML_INCLUDEDIR='-I${includedir}/libxml2'
21  21
22 XML_CFLAGS="" 22 XML_CFLAGS=""
 23@@ -13815,13 +13815,13 @@ else
 24 if test "$with_threads" = "pthread" || test "$with_threads" = "" || test "$with_threads" = "yes" ; then
 25 ac_fn_c_check_header_mongrel "$LINENO" "pthread.h" "ac_cv_header_pthread_h" "$ac_includes_default"
 26 if test "x$ac_cv_header_pthread_h" = x""yes; then :
 27- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_join in -lpthread" >&5
 28-$as_echo_n "checking for pthread_join in -lpthread... " >&6; }
 29+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_join in ${PTHREAD_LDFLAGS} ${PTHREAD_LIBS}" >&5
 30+$as_echo_n "checking for pthread_join in ${PTHREAD_LDFLAGS} ${PTHREAD_LIBS}... " >&6; }
 31 if test "${ac_cv_lib_pthread_pthread_join+set}" = set; then :
 32 $as_echo_n "(cached) " >&6
 33 else
 34 ac_check_lib_save_LIBS=$LIBS
 35-LIBS="-lpthread $LIBS"
 36+LIBS="${PTHREAD_LDFLAGS} ${PTHREAD_LIBS} $LIBS"
 37 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 38 /* end confdefs.h. */
 39
 40@@ -13853,7 +13853,7 @@ fi
 41 $as_echo "$ac_cv_lib_pthread_pthread_join" >&6; }
 42 if test "x$ac_cv_lib_pthread_pthread_join" = x""yes; then :
 43
 44- THREAD_LIBS="-lpthread"
 45+ THREAD_LIBS="${PTHREAD_LDFLAGS} ${PTHREAD_LIBS}"
 46
 47 $as_echo "#define HAVE_LIBPTHREAD /**/" >>confdefs.h
 48
23@@ -14582,10 +14582,10 @@ $as_echo "#define snprintf _snprintf" >> 49@@ -14582,10 +14582,10 @@ $as_echo "#define snprintf _snprintf" >>
24  50
25 $as_echo "#define vsnprintf _vsnprintf" >>confdefs.h 51 $as_echo "#define vsnprintf _vsnprintf" >>confdefs.h
26  52
27- if test "${PYTHON}" != "" 53- if test "${PYTHON}" != ""
28- then 54- then
29- WIN32_EXTRA_PYTHON_LIBADD="-L${pythondir}/../../libs -lpython${PYTHON_VERSION//./}" 55- WIN32_EXTRA_PYTHON_LIBADD="-L${pythondir}/../../libs -lpython${PYTHON_VERSION//./}"
30- fi 56- fi
31+# if test "${PYTHON}" != "" 57+# if test "${PYTHON}" != ""
32+# then 58+# then
33+# WIN32_EXTRA_PYTHON_LIBADD="-L${pythondir}/../../libs -lpython${PYTHON_VERSION//./}" 59+# WIN32_EXTRA_PYTHON_LIBADD="-L${pythondir}/../../libs -lpython${PYTHON_VERSION//./}"
34+# fi 60+# fi
35 ;; 61 ;;