Re: [xslt] Segmentation faults returning variable value from exslt functions II



On Thu, Jun 14, 2007 at 01:20:00PM -0700, Marc Adkins wrote:
> I have another example of segmentation faults when returning values from
> exslt functions.  Again, I can't give you a minimal test stylesheet
> (durn it), but this one has a slightly different configuration and the
> solution may be of interest.
> 
> The function itself is a pretty straightforward substitute for the
> non-existent fn:lower-case() xpath function:
> 
>     <func:function name="wpn:lowercase">
>         <xsl:param name="str" />
>         <func:result
> select="translate($str,$upper_alphabet,$lower_alphabet)" />
>     </func:function>
> 
> In this case I was not able to modify the function itself so as to get
> rid of the segmentation fault.  Nothing worked.
> 
> The original place where the segfault was happening was the line:
> 
>     <xsl:variable name="lower" select="wpn:lowercase(string(.))" />
> 
> The following modification removed the segfault:
> 
>     <xsl:variable name="lower">
>         <xsl:value-of select="wpn:lowercase(string(.))" />
>     </xsl:variable>
> 
> Interesting, neh?

  those problem are related to life time of the returned values. func:function
breaks one of the assumtions of levels in XSLT-1.0 which was that the lifetime
of a value was up to the end of the containing block (with exception of
global variables computed once at start). Lot of work and time has been 
spent trying to work around the initial model in libxslt. Apparently you're
pushing the enveloppe or there is a nasty bug in the current algorithm.
Without full reproductible test cases with xsltproc it will be near impossible
to debug (assuming me or William find the time because in practice that's
who ends up fixing those usually).

> I have done some cursory code inspection.  All that bought me was the
> knowledge that cursory code inspection was insufficient.  Duh.
> 
> I can duplicate this with xsltproc and our entire body of templates.  I
> would take a whack at debugging through at this point if I knew how to
> get started with the debugger with libxml/libxslt.  For example, are
> there debugging parameters to make?  Is there a web page giving hints on
> this?

  You can use xsltproc -v to have full dumps. you can then make two runs
diff the 2 output and try to breakpoint when you're reaching the place
where a difference occurs.
  For compilation with debug -g in the CFLAGS, at least on Unix and drop
the -O in the Makefile of libxslt, libexslt, and xsltproc ... 

Daniel

-- 
Red Hat Virtualization group http://redhat.com/virtualization/
Daniel Veillard      | virtualization library  http://libvirt.org/
veillard redhat com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine  http://rpmfind.net/


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