[lxml-dev] lxml 2.1.4/2.2beta1 Solaris 9 segv in test-suite

jholg at gmx.de jholg at gmx.de
Wed Jan 7 10:01:03 CET 2009


Hi,

I just noticed this thread:

> Unfortunately the test "test_schematron_invalid_schema_empty" causes a
> segmentation violation with Python 2.5 and Python 2.6;

I've also run into this in Solaris 8 some time ago but never got round to really look
into it (we don't use schematron at the moment).
Here's what I found out then:

"
I'm taking another look at the seqfaults I see with schematron support, and:

0 lb54320 <at> adevp02 .../XML $
PYTHONPATH=/data/pydev/hjoukl/LXML/lxml/build/lib.solaris-2.8-sun4u-2.4 python2.4 -c "from
lxml import etree; tree=etree.parse('invalid_empty.xst'); schema = etree.Schematron(etree=tree)"
Segmentation Fault (core dumped)
139 lb54320 <at> adevp02 .../XML $
PYTHONPATH=/data/pydev/hjoukl/LXML/lxml/build/lib.solaris-2.8-sun4u-2.4 python2.4 -c "from
lxml import etree; schema = etree.Schematron(file='invalid_empty.xst')"
Traceback (most recent call last):
  File "<string>", line 1, in ?
  File "schematron.pxi", line 111, in lxml.etree.Schematron.__init__
lxml.etree.SchematronParseError: Document is not a valid Schematron schema
1 lb54320 <at> adevp02 .../XML $

When handing in a pre-parsed tree I run into the segfault, whereas I get a correct error message when leaving
file parsing to xmlSchematronParse().

As different parser context factories (xmlSchematronNewDocParserCtxt / xmlSchematronNewParserCtxt
) get used for the 2 entry points, I suspect that s.th. in libxml2 is buggy here, i.e. that
xmlSchematronNewDocParserCtxt forgets to initialize something crucial that is then erroneously
accessed in the error reporting.
"

You can also find this here:
http://thread.gmane.org/gmane.comp.python.lxml.devel/3073


I also noticed that xmllint does not suffer from this problem:

"
What I can see, though, is that using the same schematron schema with xmllint does not crash:
0 $ cat invalid_empty.xst
<schema xmlns="http://purl.oclc.org/dsdl/schematron" />

0 $ python2.4 -i -c 'from lxml import etree; print etree.LIBXML_VERSION; schema = etree.Schematron(etree.parse("invalid_empty.xst"))'
(2, 6, 30)
Segmentation Fault (core dumped)

whereas

$ /apps/pydev/bin/xmllint --schematron invalid_empty.xst foo.xml --version
/apps/pydev/bin/xmllint: using libxml version 20630
   compiled with: Threads Tree Output Push Reader Patterns Writer SAXv1 FTP HTTP DTDValid HTML Legacy C14N
Catalog XPath XPointer XInclude Iconv ISO8859X Unicode Regexps Automata Expr Schemas Schematron
Modules Debug Zlib
invalid_empty.xst:1: element schema: Schemas parser error : The schematron document
'invalid_empty.xst' has no pattern
Schematron schema invalid_empty.xst failed to compile
<?xml version="1.0"?>
<root/>
"
(archived: http://article.gmane.org/gmane.comp.python.lxml.devel/3011)


I've been using older libxml2/libxslt versions then, obviously, but the failure does appears to be the same.

Happy new year everyone,
Holger
-- 
Psssst! Schon vom neuen GMX MultiMessenger gehört? Der kann`s mit allen: http://www.gmx.net/de/go/multimessenger


More information about the lxml-dev mailing list