Skip Menu |
 

This queue is for tickets about the XML-LibXML CPAN distribution.

Report information
The Basics
Id: 16333
Status: resolved
Priority: 0/
Queue: XML-LibXML

People
Owner: Nobody in particular
Requestors: bryanh [...] giraffe-data.com
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 1.58
Fixed in: (no value)



Subject: Won't compile with Libxml that doesn't have HTML parser. htmlDocPtr undefined
Download (untitled) / with headers
text/plain 194b
One of the possible configuration of Libxml2 is without the HTML parser. Libxml.xs doesn't tolerate this. The attached patch removes the 3 HTML parse functions when Libxml2 doesn't have them.
Download nohtml.patch
text/x-diff 2.5k
diff --unif --rec XML-LibXML-1.58/LibXML.xs XML-LibXML/LibXML.xs --- XML-LibXML-1.58/LibXML.xs 2004-03-24 23:06:14.000000000 +0000 +++ XML-LibXML/LibXML.xs 2005-12-06 07:24:19.000000000 +0000 @@ -1346,19 +1346,26 @@ SV * self SV * string PREINIT: +#ifdef LIBXML_HTML_ENABLED STRLEN len; char * ptr; SV * saved_error; HV * real_obj; htmlDocPtr real_doc; int recover = 0; +#endif INIT: +#ifdef LIBXML_HTML_ENABLED ptr = SvPV(string, len); if (len <= 0) { croak("Empty string"); XSRETURN_UNDEF; } +#else + croak("HTML parser not implemented in this XML::LibXML"); +#endif CODE: +#ifdef LIBXML_HTML_ENABLED RETVAL = &PL_sv_undef; LibXML_init_error(&saved_error); real_obj = LibXML_init_parser(self); @@ -1381,6 +1388,7 @@ LibXML_cleanup_callbacks(); LibXML_cleanup_parser(); LibXML_report_error(saved_error, recover); +#endif OUTPUT: RETVAL @@ -1389,12 +1397,19 @@ SV * self SV * fh PREINIT: +#ifdef LIBXML_HTML_ENABLED SV * saved_error; HV * real_obj; htmlDocPtr real_doc; int well_formed; int recover = 0; +#endif + INIT: +#ifndef LIBXML_HTML_ENABLED + croak("HTML parser not implemented in this XML::LibXML"); +#endif CODE: +#ifdef LIBXML_HTML_ENABLED RETVAL = &PL_sv_undef; LibXML_init_error(&saved_error); real_obj = LibXML_init_parser(self); @@ -1457,6 +1472,7 @@ LibXML_cleanup_callbacks(); LibXML_cleanup_parser(); LibXML_report_error(saved_error, recover); +#endif OUTPUT: RETVAL @@ -1465,19 +1481,26 @@ SV * self SV * filename_sv PREINIT: +#ifdef LIBXML_HTML_ENABLED STRLEN len; char * filename; SV * saved_error; HV * real_obj; htmlDocPtr real_doc; int recover = 0; +#endif INIT: +#ifdef LIBXML_HTML_ENABLED filename = SvPV(filename_sv, len); if (len <= 0) { croak("Empty filename"); XSRETURN_UNDEF; } +#else + croak("HTML parser not implemented in this XML::LibXML"); +#endif CODE: +#ifdef LIBXML_HTML_ENABLED RETVAL = &PL_sv_undef; LibXML_init_error(&saved_error); real_obj = LibXML_init_parser(self); @@ -1495,6 +1518,7 @@ LibXML_cleanup_callbacks(); LibXML_cleanup_parser(); LibXML_report_error(saved_error, recover); +#endif OUTPUT: RETVAL
Download (untitled) / with headers
text/plain 478b
On út 06.pro.2005 22:55:26, GIRAFFED wrote: Show quoted text
> One of the possible configuration of Libxml2 is without the HTML > parser. Libxml.xs doesn't tolerate this. > > The attached patch removes the 3 HTML parse functions when Libxml2 > doesn't have them.
I'm really reluctant to apply such a patch. Currently, on most places, XML-LibXML expects the default set of features of libxml2 to be enabled. And we don't have enough maintainer power ATM to test all possible combinations.
Download (untitled) / with headers
text/plain 771b
On Thu Jun 22 05:23:14 2006, PAJAS wrote: Show quoted text
> we don't have enough maintainer power ATM to test all > possible combinations.
To my mind, that's an argument in favor of accepting patches like this from the community. Those of us on the fringes, no matter how few, test the fringe combinations as we try to use the package. Accomodating no- HTML libxml2 in the code doesn't mean the maintainers sign up to ensure it works with no-HTML libxml2. This kind of patch has virtually no chance of screwing up the normal combinations, since every bit of code is under ifdef of a macro that is the same for all the normal combinations. Also, I wouldn't have bothered to suggest it except for the fact that there are ifdefs for a few other libxml2 options in there today.
Download (untitled) / with headers
text/plain 1.1k
On čt 22.čen.2006 11:38:20, GIRAFFED wrote: Show quoted text
> On Thu Jun 22 05:23:14 2006, PAJAS wrote:
> > we don't have enough maintainer power ATM to test all > > possible combinations.
> > To my mind, that's an argument in favor of accepting patches like
this Show quoted text
> from the community. Those of us on the fringes, no matter how few,
test Show quoted text
> the fringe combinations as we try to use the package. Accomodating
no- Show quoted text
> HTML libxml2 in the code doesn't mean the maintainers sign up to
ensure Show quoted text
> it works with no-HTML libxml2. > > This kind of patch has virtually no chance of screwing up the normal > combinations, since every bit of code is under ifdef of a macro that
is Show quoted text
> the same for all the normal combinations. Also, I wouldn't have > bothered to suggest it except for the fact that there are ifdefs for
a Show quoted text
> few other libxml2 options in there today.
ok, I see your point. Please update your patch so that it applies cleanly to current CVS snapshot, test that XML-LibXML compiles with it against a no-HTML libxml2 and passes all tests. Then I be willing to commit it. Checkout with cvs -d:pserver:anonymous@cvs.axkit.org:/home/cvs -z3 co XML-LibXML
Download (untitled) / with headers
text/plain 314b
Here's a patch for current CVS (nohtml-2.patch) It passes all the 'make test' tests except for the HTML ones, where it displays the appropriate error message. I couldn't run the threads test because I don't have threads.pm, and some of the callbacks tests, apparently because I don't have /etc/xml/catalog:1.
Download nothml-2.patch
text/x-diff 3k
Index: LibXML.xs =================================================================== RCS file: /home/cvs/XML-LibXML/LibXML.xs,v retrieving revision 1.194 diff -u -r1.194 LibXML.xs --- LibXML.xs 23 Jun 2006 10:19:33 -0000 1.194 +++ LibXML.xs 24 Jun 2006 18:51:24 -0000 @@ -1227,19 +1227,26 @@ SV * self SV * string PREINIT: +#ifdef LIBXML_HTML_ENABLED STRLEN len; char * ptr; SV * saved_error = sv_2mortal(newSVpv("",0)); HV * real_obj; htmlDocPtr real_doc; int recover = 0; +#endif INIT: +#ifdef LIBXML_HTML_ENABLED ptr = SvPV(string, len); if (len <= 0) { croak("Empty string"); XSRETURN_UNDEF; } +#else + croak("HTML parser not implemented in this XML::LibXML"); +#endif CODE: +#ifdef LIBXML_HTML_ENABLED RETVAL = &PL_sv_undef; LibXML_init_error_ctx(saved_error); real_obj = LibXML_init_parser(self); @@ -1261,6 +1268,7 @@ LibXML_cleanup_parser(); LibXML_report_error_ctx(saved_error, recover); +#endif OUTPUT: RETVAL @@ -1269,12 +1277,19 @@ SV * self SV * fh PREINIT: +#ifdef LIBXML_HTML_ENABLED SV * saved_error = sv_2mortal(newSVpv("",0)); HV * real_obj; htmlDocPtr real_doc; int well_formed; int recover = 0; +#endif + INIT: +#ifndef LIBXML_HTML_ENABLED + croak("HTML parser not implemented in this XML::LibXML"); +#endif CODE: +#ifdef LIBXML_HTML_ENABLED RETVAL = &PL_sv_undef; LibXML_init_error_ctx(saved_error); real_obj = LibXML_init_parser(self); @@ -1336,6 +1351,7 @@ LibXML_cleanup_parser(); LibXML_report_error_ctx(saved_error, recover); +#endif OUTPUT: RETVAL @@ -1344,19 +1360,26 @@ SV * self SV * filename_sv PREINIT: +#ifdef LIBXML_HTML_ENABLED STRLEN len; char * filename; SV * saved_error = sv_2mortal(newSVpv("",0)); HV * real_obj; htmlDocPtr real_doc; int recover = 0; +#endif INIT: +#ifdef LIBXML_HTML_ENABLED filename = SvPV(filename_sv, len); if (len <= 0) { croak("Empty filename"); XSRETURN_UNDEF; } +#else + croak("HTML parser not implemented in this XML::LibXML"); +#endif CODE: +#ifdef LIBXML_HTML_ENABLED RETVAL = &PL_sv_undef; LibXML_init_error_ctx(saved_error); real_obj = LibXML_init_parser(self); @@ -1373,6 +1396,7 @@ LibXML_cleanup_parser(); LibXML_report_error_ctx(saved_error, recover); +#endif OUTPUT: RETVAL @@ -2024,8 +2048,11 @@ CODE: xs_warn( "use no formated toString!" ); LibXML_init_error_ctx(saved_error); +#ifdef LIBXML_HTML_ENABLED htmlDocDumpMemory(self, &result, (int*)&len); - +#else + croak("HTML parser not implemented in this XML::LibXML"); +#endif LibXML_report_error_ctx(saved_error, 0); if (result == NULL) {
Download (untitled) / with headers
text/plain 963b
On so 24.čen.2006 15:02:22, GIRAFFED wrote: Show quoted text
> Here's a patch for current CVS (nohtml-2.patch) > > It passes all the 'make test' tests except for the HTML ones, where
it Show quoted text
> displays the appropriate error message. > > I couldn't run the threads test because I don't have threads.pm, and > some of the callbacks tests, apparently because I don't have > /etc/xml/catalog:1.
Thanks, applied cleanly, so I'll commit it just as it is. About the failed tests: 1) 30threads.t is supposed to be skipped if threads are not compiled in, so I wonder why it wasn't on your system. Anyway, can you check if it is skipped if you change if( $Config{useithreads} ) to if ( $Config{useithreads} && eval { require threads } ) { in that file? 2) if I remove /etc/xml/catalog from my system, I still can't make any test fail. Can you post the output of the tests that fail (except for html and treads) when running them as perl -Mblib t/NNwhatevertest.t Thanks, -- Petr
I opened some new tickets for the test issues, with the information you asked for.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.