snapframework/xmlhtml

0.2.4 fails to build from source on some 32 bit architectures "numericalEscapes : [Failed]"

Closed this issue · 9 comments

(maybe it fails on all 32 bit archs)

https://buildd.debian.org/status/package.php?p=haskell-xmlhtml&suite=unstable

test/src/Text/XmlHtml/Tests.hs:20:1: warning: [-Wunused-imports]
    The qualified import of `Text.Blaze.Internal' is redundant
      except perhaps to import instances from `Text.Blaze.Internal'
    To import instances alone, use: import Text.Blaze.Internal()
[6 of 6] Compiling Main             ( test/src/TestSuite.hs, dist-ghc/build/testsuite/testsuite-tmp/Main.o )
Linking dist-ghc/build/testsuite/testsuite ...
touch build-ghc-stamp
. /usr/share/haskell-devscripts/Dh_Haskell.sh && \
check_recipe
Running debian/hlibrary.setup test --builddir=dist-ghc --show-details=direct
Running 1 test suites...
Test suite testsuite: RUNNING...
byteOrderMark          : [OK]
emptyDocument          : [OK]
publicDocType          : [OK]
systemDocType          : [OK]
emptyDocType           : [OK]
dtdInternalScan        : [OK]
textOnly               : [OK]
textWithRefs           : [OK]
untermRef              : [OK]
textWithCDATA          : [OK]
cdataOnly              : [OK]
commentOnly            : [OK]
emptyElement           : [OK]
emptyElement2          : [OK]
elemWithText           : [OK]
xmlDeclXML             : [OK]
procInst               : [OK]
badDoctype1            : [OK]
badDoctype2            : [OK]
badDoctype3            : [OK]
badDoctype4            : [OK]
badDoctype5            : [OK]
tagNames               : [OK]
emptyDocumentHTML      : [OK]
publicDocTypeHTML      : [OK]
systemDocTypeHTML      : [OK]
emptyDocTypeHTML       : [OK]
textOnlyHTML           : [OK]
textWithRefsHTML       : [OK]
textWithCDataHTML      : [OK]
cdataOnlyHTML          : [OK]
commentOnlyHTML        : [OK]
emptyElementHTML       : [OK]
emptyElement2HTML      : [OK]
elemWithTextHTML       : [OK]
xmlDeclHTML            : [OK]
procInstHTML           : [OK]
badDoctype1HTML        : [OK]
badDoctype2HTML        : [OK]
badDoctype3HTML        : [OK]
badDoctype4HTML        : [OK]
badDoctype5HTML        : [OK]
voidElem               : [OK]
caseInsDoctype1        : [OK]
caseInsDoctype2        : [OK]
voidEmptyElem          : [OK]
rawTextElem            : [OK]
endTagCase             : [OK]
hexEntityCap           : [OK]
laxAttrName            : [OK]
badAttrName            : [OK]
emptyAttr              : [OK]
emptyAttr2             : [OK]
unquotedAttr           : [OK]
laxAttrVal             : [OK]
ampersandInText        : [OK]
omitOptionalEnds       : [OK]
omitEndHEAD            : [OK]
omitEndLI              : [OK]
omitEndDT              : [OK]
omitEndDD              : [OK]
omitEndP               : [OK]
omitEndRT              : [OK]
omitEndRP              : [OK]
omitEndOPTGRP          : [OK]
omitEndOPTION          : [OK]
omitEndCOLGRP          : [OK]
omitEndTHEAD           : [OK]
omitEndTBODY           : [OK]
omitEndTFOOT           : [OK]
omitEndTR              : [OK]
omitEndTD              : [OK]
omitEndTH              : [OK]
testNewRefs            : [OK]
errorImplicitClose     : [OK]
weirdScriptThing       : [OK]
renderByteOrderMark    : [OK]
renderByteOrderMarkLE  : [OK]
singleQuoteInSysID     : [OK]
doubleQuoteInSysID     : [OK]
bothQuotesInSysID      : [OK]
doubleQuoteInPubID     : [OK]
doubleDashInComment    : [OK]
trailingDashInComment  : [OK]
renderEmptyText        : [OK]
singleQuoteInAttr      : [OK]
doubleQuoteInAttr      : [OK]
bothQuotesInAttr       : [OK]
ndashEscapesInLatin    : [OK]
smileyEscapesInLatin   : [OK]
numericalEscapes       : [Failed]
numericalEscapes       
hRenderByteOrderMark   : [OK]
hSingleQuoteInSysID    : [OK]
hDoubleQuoteInSysID    : [OK]
hBothQuotesInSysID     : [OK]
hDoubleQuoteInPubID    : [OK]
hDoubleDashInComment   : [OK]
hTrailingDashInComment : [OK]
hRenderEmptyText       : [OK]
hSingleQuoteInAttr     : [OK]
hDoubleQuoteInAttr     : [OK]
hBothQuotesInAttr      : [OK]
renderHTMLVoid         : [OK]
renderHTMLVoid2        : [OK]
renderHTMLRaw          : [OK]
renderHTMLRawMult      : [OK]
renderHTMLRaw2         : [OK]
renderHTMLRaw3         : [OK]
renderHTMLRaw4         : [OK]
renderHTMLEmptyAttr    : [OK]
renderHTMLEmptyAttr2   : [OK]
renderHTMLAmpAttr1     : [OK]
renderHTMLAmpAttr2     : [OK]
renderHTMLAmpAttr3     : [OK]
renderHTMLQVoid        : [OK]
renderHTMLQVoid2       : [OK]
renderHTMLQRaw         : [OK]
renderHTMLQRawMult     : [OK]
renderHTMLQRaw2        : [OK]
renderHTMLQRaw3        : [OK]
renderHTMLQRaw4        : [OK]
compareExternalIDs     : [OK]
compareInternalSubs    : [OK]
compareDoctypes        : [OK]
compareNodes           : [OK]
compareDocuments       : [OK]
compareEncodings       : [OK]
exerciseShows          : [OK]
docNodeAccessors       : [OK]
isTextNodeYes          : [OK]
isTextNodeNo           : [OK]
isTextNodeNo2          : [OK]
isCommentYes           : [OK]
isCommentNo            : [OK]
isCommentNo2           : [OK]
isElementYes           : [OK]
isElementNo            : [OK]
isElementNo2           : [OK]
tagNameElement         : [OK]
tagNameText            : [OK]
tagNameComment         : [OK]
getAttributePresent    : [OK]
getAttributeMissing    : [OK]
getAttributeWrongType  : [OK]
hasAttributePresent    : [OK]
hasAttributeMissing    : [OK]
hasAttributeWrongType  : [OK]
setAttributeNew        : [OK]
setAttributeReplace    : [OK]
setAttributeWrongType  : [OK]
nestedNodeText         : [OK]
childNodesElem         : [OK]
childNodesOther        : [OK]
childElemsTest         : [OK]
childElemsTagTest      : [OK]
childElemTagExists     : [OK]
childElemTagNotExists  : [OK]
childElemTagOther      : [OK]
descNodesElem          : [OK]
descNodesOther         : [OK]
descElemsTest          : [OK]
descElemsTagTest       : [OK]
descElemTagExists      : [OK]
descElemTagDFS         : [OK]
descElemTagNotExists   : [OK]
descElemTagOther       : [OK]
fromNodeAndCurrent     : [OK]
fromNodesAndSiblings   : [OK]
leftSiblings           : [OK]
emptyFromNodes         : [OK]
cursorNEQ              : [OK]
cursorNavigation       : [OK]
cursorSearch           : [OK]
cursorMutation         : [OK]
cursorInsertion        : [OK]
cursorDeletion         : [OK]
blazeTestString        : [OK]
blazeTestText          : [OK]
blazeTestBS            : [OK]
blazeTestPre           : [OK]
blazeTestExternal      : [OK]
blazeTestCustom        : [OK]
blazeTestMulti         : [OK]
blazeTestEmpty         : [OK]
xmlhtml/ibm-not-wf     : [OK]
xmlhtml/ibm-invalid    : [OK]
xmlhtml/ibm-valid      : [OK]
xmlhtml/oasis          : [OK]
xmlhtml/r-ibm-not-wf   : [OK]
xmlhtml/r-ibm-invalid  : [OK]
xmlhtml/r-ibm-valid    : [OK]
xmlhtml/r-oasis        : [OK]
xmlhtml/h-ibm-not-wf   : [OK]
xmlhtml/h-ibm-invalid  : [OK]
xmlhtml/h-ibm-valid    : [OK]
xmlhtml/h-oasis        : [OK]
xmlhtml/hr-ibm-not-wf  : [OK]
xmlhtml/hr-ibm-invalid : [OK]
xmlhtml/hr-ibm-valid   : [OK]
xmlhtml/hr-oasis       : [OK]

         Test Cases    Total        
 Passed  199           199          
 Failed  1             1            
 Total   200           200          
Test suite testsuite: FAIL
Test suite logged to: dist-ghc/test/xmlhtml-0.2.4-testsuite.log
0 of 1 test suites (0 of 1 test cases) passed.
/usr/share/cdbs/1/class/hlibrary.mk:154: recipe for target 'check-ghc-stamp' failed
make: *** [check-ghc-stamp] Error 1
dpkg-buildpackage: error: debian/rules build-arch gave error exit status 2
--------------------------------------------------------------------------------
Build finished at 2017-06-21T09:39:07Z

Finished
--------

Because of the way the testsuite is structured, it doesn't output the failing value: in this case, what fmap (toByteString . renderXmlFragment ISO_8859_1 . docContent) (parseXML "test" "Hello ®") evaluates to on 32-bit architectures.

sooo, do you have a patch? what is the best solution? I don't see how to force 64 bit casting on that function, or maybe I'm just missing completely the issue, since I don't understand haskell :)

Yeah, it works for me so I'm not really sure what to do here. I'd recommend using the REPL to find out what it evaluates to on those architectures and then working from there to find a fix. I'm definitely willing to accept a PR for this. Also, if there's a way to set up something that can test this in Travis, that would be great too.

@mightybyte I think somewhere we can tweak cabal into install 32 bit libraries, but I'm not sure about how to do it
https://ghc.haskell.org/trac/ghc/wiki/Building/Compiling32on64

If you convert that test to use assertEqual, the problem appears to be

expected: Right "Hello ®"
 but got: Right "Hello ®"

Not sure why capitalization is different on 32-bit

On my system, this fails with:

expected: Right "Hello ®"
 but got: Right "Hello ®"

The problem seems to be that all three of REG, reg and circledR map to the same \x000AE value.

When the reversePredefinedRefs HashMap is being created, the function M.toList is being used, which gives no guarantees about the order of its result. That's why we get different results on different systems. Either the test should be fixed to consider all of the above as valid results or (even better) we should make reversePredefinedRefs deterministic.

@iliastsi I'm familiar with this problem. Great find! I think the problem is because HashMap is unordered. I just pushed a branch called deterministic-refs that changes it to use Map. Can you check if that branch fixes the problem?

@mightybyte I tested your branch and it fixes the above problem for me. Thanks!

Released as 0.2.5.1.