Skip Menu |

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

Report information
The Basics
Id: 93852
Status: open
Priority: 0/
Queue: XML-LibXML

People
Owner: Nobody in particular
Requestors: SHLOMIF [...] cpan.org
Cc: wellnhofer [...] aevum.de
AdminCc:

Bug Information
Severity: Important
Broken in: 2.0112
Fixed in: (no value)



CC: wellnhofer [...] aevum.de
Subject: New Test ("4 validate a node") fails in t/26schema.t on some systems
I received CPAN Tester failure reports with XML-LibXML-2.0112 and they appear to be mostly about the new test that Nick added to t/26schema.t to be failing on various systems. Here is the quote with the links: [QUOTE] XML-LibXML-2.0112: - MSWin32-x64-multi-thread / 5.16.3: - FAIL http://www.cpantesters.org/cpan/report/9c58c678-6bf4-1014-8263-5f8746601f20 - MSWin32-x86-multi-thread / 5.16.3: - FAIL http://www.cpantesters.org/cpan/report/7002b53f-6bf4-1014-8b7c-138646601f20 - amd64-freebsd / 5.19.9: - FAIL http://www.cpantesters.org/cpan/report/88e6f386-ab08-11e3-85b0-fddbe0bfc7aa - x86_64-gnukfreebsd-thread-multi / 5.12.3: - FAIL http://www.cpantesters.org/cpan/report/f35655c0-aae7-11e3-ae04-8631d666d1b8 - x86_64-linux-thread-multi-ld / 5.8.9: - FAIL http://www.cpantesters.org/cpan/report/f75bd296-aae0-11e3-ae04-8631d666d1b8 [/QUOTE] Nick, can you look into it? Thanks, -- Shlomi Fish
The test failures seem to be caused by this bug in libxml2: https://git.gnome.org/browse/libxml2/commit/?id=1f6c42cffd8db69fd0243b2baa74104d66a3b05e It was fixed in libxml2 2.9.1. See the attached patch for a work-around. If you like, I can also send a pull request.
Subject: rt93852.diff
diff -r 65ead9db9cd5 t/26schema.t --- a/t/26schema.t Thu Mar 13 20:18:44 2014 +0200 +++ b/t/26schema.t Fri Mar 14 12:58:50 2014 +0100 @@ -15,7 +15,7 @@ use XML::LibXML; if ( XML::LibXML::LIBXML_VERSION >= 20510 ) { - plan tests => 7; + plan tests => 8; } else { plan skip_all => 'No Schema Support compiled.'; @@ -74,16 +74,12 @@ # 4 validate a node { my $doc = $xmlparser->load_xml(string => <<'EOF'); -<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> - <soap:Body> - <shiporder orderid="889923"> - <orderperson>John Smith</orderperson> - <shipto> - <name>Ola Nordmann</name> - </shipto> - </shiporder> - </soap:Body> -</soap:Envelope> +<shiporder orderid="889923"> + <orderperson>John Smith</orderperson> + <shipto> + <name>Ola Nordmann</name> + </shipto> +</shiporder> EOF my $schema = XML::LibXML::Schema->new(string => <<'EOF'); @@ -92,24 +88,27 @@ <xs:complexType> <xs:sequence> <xs:element name="orderperson" type="xs:string"/> - <xs:element name="shipto"> - <xs:complexType> - <xs:sequence> - <xs:element name="name" type="xs:string"/> - </xs:sequence> - </xs:complexType> - </xs:element> + <xs:element ref="shipto"/> </xs:sequence> <xs:attribute name="orderid" type="xs:string" use="required"/> </xs:complexType> </xs:element> + <xs:element name="shipto"> + <xs:complexType> + <xs:sequence> + <xs:element name="name" type="xs:string"/> + </xs:sequence> + </xs:complexType> + </xs:element> </xs:schema> EOF - my $nodelist = $doc->findnodes('/soap:Envelope/soap:Body/shiporder'); + my $nodelist = $doc->findnodes('/shiporder/shipto'); my $result = 1; eval { $result = $schema->validate($nodelist->get_node(1)); }; # TEST - ok( $result == 0 && !$@, 'validate() works with elements.' ); + is( $@, '', 'validate() with element doesn\'t throw' ); + # TEST + is( $result, 0, 'validate() with element returns 0' ); }
Hi Nick, On Fri Mar 14 08:03:36 2014, NWELLNHOF wrote: Show quoted text
> The test failures seem to be caused by this bug in libxml2: > > https://git.gnome.org/browse/libxml2/commit/?id=1f6c42cffd8db69fd0243b2baa74104d66a3b05e > > It was fixed in libxml2 2.9.1. See the attached patch for a work- > around. If you like, I can also send a pull request.
Thanks for the diagnosis and the patch. I applied it in 2.0113 which I uploaded to CPAN. I'll close this bug if I'm not getting any more test failures. Regards, -- Shlomi Fish