Hi,
The following diff removes --without-threads option from libxml2 build.
The reason is it makes libxml2 not thread safe, and we are using it
in threaded programs, resulting possible memory corruption.
I found it while chasing a bug (corrupted canary/double free reported by
free(3)) on program of mine, from python to lxml to libxml.
With the current textproc/libxml build, the testsuite of
textproc/py-lxml doesn't pass. It fails on test_thread_error_log test
case (passing MALLOC_OPTIONS=S helps a lot for the reproductibility).
The lxml test calls in loop, and in several threads, XML parsing on
errornous documents and check the error. The test dies because free(3)
detects memory corruption and call abort(3).
Without the option --without-threads on libxml, the lxml's test passes.
I checked on amd64 that no symbols were added/removed on libxml2.so, and
WANTLIB is still the same too (pthread was already here). The testsuite
of libxml still pass and the one from py-lxml passes (whereas it wasn't
the case before).
I would be interested to know any downside of enabling thread safety on
libxml2.
Thanks.
--
Sebastien Marie
Index: Makefile
===================================================================
RCS file: /cvs/ports/textproc/libxml/Makefile,v
retrieving revision 1.175
diff -u -p -r1.175 Makefile
--- Makefile 30 Jun 2018 11:41:36 -0000 1.175
+++ Makefile 12 Jan 2019 15:06:13 -0000
@@ -10,7 +10,7 @@ PKGNAME-python= py-libxml-${VERSION}
SHARED_LIBS += xml2 16.1 # 11.8
CATEGORIES= textproc
MASTER_SITES= ftp://xmlsoft.org/libxml/
-REVISION-main= 0
+REVISION-main= 1
HOMEPAGE= http://xmlsoft.org/
@@ -28,8 +28,8 @@ CONFIGURE_ARGS+= --enable-static \
--with-html-dir="${PREFIX}/share/doc" \
--with-html-subdir="libxml2/html" \
--with-iconv="${LOCALBASE}" \
- --with-lzma="${LOCALBASE}" \
- --without-threads
+ --with-lzma="${LOCALBASE}"
+
# only used to fetch data during regression test
CONFIGURE_ENV= WGET=/usr/bin/ftp