GNOME Bugzilla – Bug 170533
xsltFreeStylesheet for xsl:text
Last modified: 2009-08-15 18:40:50 UTC
Steps to reproduce: 1. Compile this program using libxslt 1.1.13, libxml2 2.6.18, and gcc 3.4.0 on SunOS 5.9 sparc: xsltStylesheetPtr cur = NULL; xmlDocPtr doc; xmlDocPtr doc_copy; /* Load the document, copy it, and parse it as a stylesheet. */ doc = xmlReadFile( argv[1], NULL, 0 ); doc_copy = xmlCopyDoc(doc, 1); xmlSubstituteEntitiesDefault(1); xmlLoadExtDtdDefaultValue = 1; cur = xsltParseStylesheetDoc(doc_copy); /* Free the memory. Comment this and the problem goes away. */ xsltFreeStylesheet(cur); 2. Execute it using the name of this XSLT file as argv[1]: <?xml version="1.0" encoding="iso-8859-1"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" > <xsl:template match="/"> <a> <xsl:attribute name="href"> <!-- The problem always seems related to xsl:text. --> <xsl:text>#</xsl:text> <!-- Add this back and the problem goes away. --> <!-- <xsl:value-of select="@id" /> --> </xsl:attribute> </a> </xsl:template> </xsl:stylesheet> 3. I consistently get a bus error. Stack trace:
+ Trace 56930
Thread 2 (Thread 1 (LWP 1))
Thread 1 (LWP 1 )
Other information: XML::GDOME::XSLT (0.75) for perl employs similar code and so crashes for just basic usage: use XML::GDOME::XSLT; my $xslt_doc = XML::GDOME->createDocFromURI( $ARGV[0] ); my $xslt_parser = XML::GDOME::XSLT->new(); my $xslt = $xslt_parser->parse_stylesheet( $xslt_doc );
This problem was caused by the lack of a dictionary on the stylesheet document (an expected result of xmlCopyDoc, and certainly not an error on your part). Fixed in CVS (libxslt/xslt.c), but only tested on x86 (should be ok on all architectures). Thanks for the report, and the clear test case. Bill
I hope this is the right place to ask this question.... I'm not familiar with the internals of libxslt. If I replace libxslt/xslt.c in 1.1.13 with the snapshot version, should that be sufficient to get a stable build of libxslt? Is there a better approach? Btw, I noticed that the tar.gz for the latest CVS snapshot is actually 1.1.12. Joel
Oops - looks like the CVS-snapshot on xmlsoft.org has a problem. It will get fixed later today. If you are in a hurry, you can also get the cvs directly using "cvs -z3 co libxslt" (see http://developer.gnome.org/tools/cvs.html). In this particular case (this is actually the first bug to be fixed since the last release) it would be sufficient to just copy the changed module (libxslt/xslt.c) from the cvs directory into the release directory and re- compile the source. As a general rule, however, the safest thing is to just take the cvs snapshot and compile it in the normal way (./autogen.sh [optional config params] followed by make). In this manner, you will be assured to get any other fixes which have been made. Although I'm happy to respond to this sort of question via Bugzilla, it would actually have been better had you posed it on the mailing list (xslt@gnome.org). In that manner, others who may have a similar question (but are reluctant to ask it), as well as future users who may do mailing list searches, could possibly benefit from the response. Regards, Bill
Thanks very much for your help. I will pass the fix on to our sys admin. If there are any additional problems related to this bug, I'll post a follow-up in Bugzilla. In the future, I will target the mailing list for the more general questions. Joel
I fixed the libxslt CVS snapshot generation on xmlsoft.org, Daniel
The patch is working great. Thanks again. Joel
This should be closed by release of libxslt-1.1.15 thanks, Daniel