[xslt] Strange problem



Hi,

with debian testing, esp. libxslt1.1_1.1.28-2_i386, using
  xsltproc bug.xsl in.xml
results in
<root>a<s/><!-- c -->db<s/><!-- f -->e</root>
instead of the expected original ordering.

Issuing
  valgrind xsltproc bug.xsl in.xml
makes the bug disappear:
<root>a<s/>b<!-- c -->d<s/>e<!-- f --></root>
Valgrind does not report any error, though.

Also, calling xsltApplyStylesheetUser, ... in my own code gives the correct output.

Further investigation revealed that the _amd64 packages do not exhibit the problem. When using libxslt1.1_1.1.26-13_i386 (and corresponding xsltproc, ...) with libxml2_2.8.0+dfsg1-5_i386 the problem still persists. While trying an older libxslt/xsltproc with a newer libxml2, I've also seen (IIRC):
<root>a<s/>b<!-- c -->d<s/><!-- f -->e</root>
Note that f and e are still swapped.

Building libxslt_1.1.28.orig.tar.gz myself using just "./configure; make" results in a correct xsltproc, but
using dpkg-buildpackage results in a bad xsltproc.

Analyzing the differences in these two build processes, I found that
  ./configure LDFLAGS="-pie"
is enough to trigger the problem. It's also sufficient to compile/link xsltproc with it. Even using the original/system (debian) shared libxslt library with the newly compiled xsltproc will trigger resp. fix the problem.
I'm using debian's gcc, version 4.7.1.

I don't really know how to proceed from here. Maybe someone with more knowledge of libxslt has some idea, what the root cause could be? I suspect that -pie is just another trigger, just as valgrind suppresses the buggy behavior...

  Tobias

--- bug.xsl ---
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; version="1.0"
                xmlns:exsl="http://exslt.org/common";
                extension-element-prefixes="exsl">

<xsl:output method="xml" encoding="utf-8"/>

<xsl:template match="/">
<xsl:variable name="sn0" select="node()"/>
<xsl:variable name="sn1"><xsl:copy-of select="node()"/></xsl:variable>
<xsl:apply-templates select="exsl:node-set($sn1)" mode="m"/>
</xsl:template>

<xsl:template match="@*|node()|comment()" mode="m">
<xsl:copy>
<xsl:apply-templates select="@*|node()|comment()" mode="m"/>
</xsl:copy>
</xsl:template>

</xsl:stylesheet>

--- in.xml ---
<?xml version="1.0" encoding="utf-8"?>
<root>a<s/>b<!-- c -->d<s/>e<!-- f --></root>



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]