List Info

Thread: Segmentation fault with XML::LibXSLT




Segmentation fault with XML::LibXSLT
user name
2007-09-20 11:08:48
Hi,

I'm *sometimes* getting segmentation faults in a script that
uses
XML::LibXSLT. By a process of elimination, I've tracked it
down to the
following lines (part of a loop) in the script,:

    warn("about to transform");
    my $tmp1 = $xslt_stylesheet->transform($_);
    warn("about to convert to string");
    my $tmp2 = $xslt_stylesheet->output_string( $tmp1 );
    warn("assiging to hash");
    $l1text{$chapter_title}{$section_title} = $tmp2;

When I run the script the output looks like this:

    16:53:26 ~/userspace/autodoc
    andrewmcfandrewmcfarland$ ./l1structure.pl -a >
test.html
    about to transform at ./l1structure.pl line 183.
    about to convert to string at ./l1structure.pl line
185.
    assiging to hash at ./l1structure.pl line 187.
    about to transform at ./l1structure.pl line 183.
    Segmentation fault (core dumped)
    16:54:11 ~/userspace/autodoc
    andrewmcfandrewmcfarland$

This looks like a problem with the transform() method.

$xslt_stylesheet is created at the start of the script like
this:

    $xslt = XML::LibXSLT->new();
    $xslt_doc =
$parser->parse_file('xsl-test/docbook.xsl');
    $xslt_stylesheet =
$xslt->parse_stylesheet($xslt_doc);

For a particular version of the script and stylesheets, the
script
either always works or always core dumps. Changing
apparently
unrelated things in the script - like warning()s and the
filename of
the script itself - will sometimes break a working script,
or fix a
broken one.

Anyone got any suggestions?

Andrew
-- 
We can't change the past, but each of us, by challenging
prejudice and
intolerance, can help to change the future.
- Rabbi Jonathan Sacks, Address at Holocaust Memorial Day,
Westminster
Hall, bond, 27th January 2005
_______________________________________________
Perl-XML mailing list
Perl-XMLlistserv.ActiveState.com
To unsubscribe: http:/
/listserv.ActiveState.com/mailman/mysubs

Re: Segmentation fault with XML::LibXSLT
country flaguser name
Germany
2007-09-21 09:46:25
* Andrew McFarland <aamcfarlandgmail.com> [2007-09-20
18:20]:
> Anyone got any suggestions?

What happens if you run the same transforms using `xsltproc`
from
the command line?

When I tried to install the most recent version of libxslt,
a
bunch of my previously working transforms started
segfaulting on
every run. They’re so large that I couldn’t be bothered
trying to
produce a minimal test case, though; in the end I just
downgraded
libxslt.

Regards,
-- 
Aristotle Pagaltzis // <http://plasmasturm.org/&g
t;
_______________________________________________
Perl-XML mailing list
Perl-XMLlistserv.ActiveState.com
To unsubscribe: http:/
/listserv.ActiveState.com/mailman/mysubs
Re: Segmentation fault with XML::LibXSLT
user name
2007-09-21 10:37:37
On 21/09/2007, A. Pagaltzis <pagaltzisgmx.de> wrote:

> What happens if you run the same transforms using
`xsltproc` from
> the command line?

I haven't encountered any problems with xsltproc on the
command line.

I've found a workaround for the problem though: XML::XSLT
does what I
need, and it doesn't segfault on me. I might try downgrading
libxml2
if I get a chance to revisit the problem.

Andrew
-- 
We can't change the past, but each of us, by challenging
prejudice and
intolerance, can help to change the future.
- Rabbi Jonathan Sacks, Address at Holocaust Memorial Day,
Westminster
Hall, bond, 27th January 2005
_______________________________________________
Perl-XML mailing list
Perl-XMLlistserv.ActiveState.com
To unsubscribe: http:/
/listserv.ActiveState.com/mailman/mysubs

Re: Segmentation fault with XML::LibXSLT
user name
2007-09-21 10:47:27
On 21/09/2007, Andrew McFarland <aamcfarlandgmail.com> wrote:
> I've found a workaround for the problem though:
XML::XSLT does what I
> need,

About 30 seconds after I sent that, I found it doesn't :-(

Anyone got any recommendations for a Perl XSLT processor?
I'll be
using the standard DocBook XSLT with it.

Andrew
-- 
We can't change the past, but each of us, by challenging
prejudice and
intolerance, can help to change the future.
- Rabbi Jonathan Sacks, Address at Holocaust Memorial Day,
Westminster
Hall, bond, 27th January 2005
_______________________________________________
Perl-XML mailing list
Perl-XMLlistserv.ActiveState.com
To unsubscribe: http:/
/listserv.ActiveState.com/mailman/mysubs

Re: Segmentation fault with XML::LibXSLT
user name
2007-09-21 10:56:33
Hi,
On Fri, 2007-09-21 at 16:37 +0100, Andrew McFarland wrote:
> On 21/09/2007, A. Pagaltzis <pagaltzisgmx.de> wrote:
> 
> > What happens if you run the same transforms using
`xsltproc` from
> > the command line?
> 
> I haven't encountered any problems with xsltproc on the
command line.
> 
> I've found a workaround for the problem though:
XML::XSLT does what I
> need

Excellent! I don't suppose there is any chance that you
could provide a
very small example that I can make into a test case so I
don't break
your code when I make a new release of XML::XSLT  I'm
planning on
making a new release in the next few months using XML:OM::XPat
h to
provide some of the missing functionality (only three years
after I had
a conversation with Matt and Michel about doing so .... )

/J
_______________________________________________
Perl-XML mailing list
Perl-XMLlistserv.ActiveState.com
To unsubscribe: http:/
/listserv.ActiveState.com/mailman/mysubs

Re: Segmentation fault with XML::LibXSLT
user name
2007-09-21 11:24:55
On Fri, 2007-09-21 at 16:47 +0100, Andrew McFarland wrote:
> On 21/09/2007, Andrew McFarland <aamcfarlandgmail.com> wrote:
> > I've found a workaround for the problem though:
XML::XSLT does what I
> > need,
> 
> About 30 seconds after I sent that, I found it doesn't
:-(

Ah, I'll take back what I just said then :- Could you
provide me with
small samples (input XML, stylesheet, expected output) of
the bits that
*aren't* working with XML::XSLT so I can make test cases so
that they
get fixed....

/J
_______________________________________________
Perl-XML mailing list
Perl-XMLlistserv.ActiveState.com
To unsubscribe: http:/
/listserv.ActiveState.com/mailman/mysubs

Re: Segmentation fault with XML::LibXSLT
user name
2007-09-21 18:39:25
On Fri, 21 Sep 2007, Jonathan Stowe wrote:

> On Fri, 2007-09-21 at 16:47 +0100, Andrew McFarland
wrote:
>> On 21/09/2007, Andrew McFarland <aamcfarlandgmail.com> wrote:
>>> I've found a workaround for the problem though:
XML::XSLT does what I
>>> need,
>>
>> About 30 seconds after I sent that, I found it
doesn't :-(
> Ah, I'll take back what I just said then :- Could you
provide me with
> small samples (input XML, stylesheet, expected output)
of the bits that
> *aren't* working with XML::XSLT so I can make test
cases so that they
> get fixed....

 	Just in case it helps, I'm getting segfaults with
XML::LibXML stuff, 
but I haven't got around to isolating it yet.  I have no
good reason to 
suspect it's libxml2, but I do anyway.  I'm not using XSLT,
but I'm doing 
stuff that involves using XPathContext, and adopting from
DocumentFragments 
without actually telling it where in the document to place
them (at least 
temporarily).  I'm intending to fiddle with this and narrow
it down, but at 
the moment, I haven't.

 	The package manager says my version is:
perl-XML-LibXML-1.62-1

 	HTH,


------------------------------------------------------------
---------
| Name: Tim Nelson                 | Because the Creator is,
       |
| E-mail: waylandsmartchat.net.au | I am                   
       |
------------------------------------------------------------
---------

----BEGIN GEEK CODE BLOCK----
Version 3.12
GCS d+++ s+: a- C++$ U+++$ P+++$ L+++ E- W+ N+ w--- V- 
PE(+) Y+>++ PGP->+++ R(+) !tv b++ DI++++ D G+
e++>++++ h! y-
-----END GEEK CODE BLOCK-----
_______________________________________________
Perl-XML mailing list
Perl-XMLlistserv.ActiveState.com
To unsubscribe: http:/
/listserv.ActiveState.com/mailman/mysubs

Re: Segmentation fault with XML::LibXSLT
user name
2007-09-24 04:14:48
Hi,

On 21/09/2007, Jonathan Stowe <jnsgellyfish.com> wrote:

> Ah, I'll take back what I just said then :- Could you
provide me with
> small samples (input XML, stylesheet, expected output)
of the bits that
> *aren't* working with XML::XSLT so I can make test
cases so that they
> get fixed....

I'm processing fairly simple DocBook using the standard
DocBook XSLT.
When I process sample.xml using XML::XSLT and the standard
DocBook
XSLT, I get the following error:

andrewmcfandrewmcfarland$ ./sample.pl
Error while parsing: Couldn't open encmap ascii.enc:
No such file or directory
 at /usr/lib/perl5/XML/Parser.pm line 187

../xsl-test/docbook-xsl-1.73.2/xhtml/docbook.xsl at
/usr/share/perl5/XML/XSLT.pm line 1507.

When I use sample.xsl (which just imports the standard
DocBook
stylesheet) I get the following output:

andrewmcfandrewmcfarland$ ./sample.pl


Chapter Title

        Section Title
        Para


When I process sample.xml using xsltproc and either the
standard
DocBook stylesheet or sample.xsl, I get the attached
sample.html file
(well, I get different IDs on elements).

Andrew
-- 
We can't change the past, but each of us, by challenging
prejudice and
intolerance, can help to change the future.
- Rabbi Jonathan Sacks, Address at Holocaust Memorial Day,
Westminster
Hall, bond, 27th January 2005

_______________________________________________
Perl-XML mailing list
Perl-XMLlistserv.ActiveState.com
To unsubscribe: http:/
/listserv.ActiveState.com/mailman/mysubs

  
  
  
  
[1-8]

about | contact  Other archives ( Real Estate discussion Medical topics )