Control: tag -1 patch
Control: forwarded -1 https://github.com/ruz/HTML-Gumbo/pull/5/commits

On Sun, Jul 29, 2018 at 03:38:37PM +0200, gregor herrmann wrote:
> Source: libhtml-gumbo-perl
> Version: 0.18-1
> Severity: serious
> Tags: upstream ftbfs
> Justification: fails to build from source (but built successfully in the past)

> libhtml-gumbo-perl 0.18-1 fails to build on mips, both on the buildd
> and on a porterbox, due to a test failure:
> 
> https://buildd.debian.org/status/fetch.php?pkg=libhtml-gumbo-perl&arch=mips&ver=0.18-1&stamp=1532865257&raw=0
> 
>    dh_auto_test -a
>       perl Build test --verbose 1
> 
> #   Failed test at t/callback.t line 57.
> #     Structures begin differing at:
> #          $got->[4] = Does not exist
> #     $expected->[4] = ARRAY(0x566c5308)
> # Looks like you failed 1 test of 3.

The attached patch seems to fix this. There's no regressing code change,
0.17-1 fails in the same way.
-- 
Niko Tyni   nt...@debian.org
>From cc8d278d2737f55ac2ef262c89849597c5929f90 Mon Sep 17 00:00:00 2001
From: Niko Tyni <nt...@debian.org>
Date: Mon, 30 Jul 2018 15:08:10 +0300
Subject: [PATCH] tree_to_callback: don't check document nodes for void
 elements

walk_tree() will call this with PHG_ELEMENT_END for both document
and element nodes, but only the latter ones have tag types defined.

This fixes test failures seen on 32-bit big endian systems
such as mips and powerpc, when a document node happened
to have a valid (void) tag code at the same offset, triggering
an early return.

Bug-Debian: https://bugs.debian.org/904914
---
 lib/HTML/Gumbo.xs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/HTML/Gumbo.xs b/lib/HTML/Gumbo.xs
index b7613a6..97dfc43 100644
--- a/lib/HTML/Gumbo.xs
+++ b/lib/HTML/Gumbo.xs
@@ -401,7 +401,7 @@ tree_to_callback(pTHX_ PerlHtmlGumboType type, GumboNode* node, void* ctx) {
     dSP;
     SV* cb = (SV*) ctx;
 
-    if ( type == PHG_ELEMENT_END && PHG_IS_VOID_ELEMENT(node->v.element.tag) )
+    if ( type == PHG_ELEMENT_END && node->type == GUMBO_NODE_ELEMENT && PHG_IS_VOID_ELEMENT(node->v.element.tag) )
         return;
 
     ENTER;
-- 
2.18.0

Reply via email to