src/Text/XML/HaXml/Lex.hs:(156, 0)-(160, 22): Non-exhaustive patterns in function white

Hello. I decided to run a couple of test XML-RPC applications using haxr. Everything worked fine while responces from my (actually, other people's) server were something relatively small (a number, a line), but with larger responces (starting around couple of kilobytes) my applications began to fail with the error I put into subject. Sounds like XML parsing problem. Though server gives a proper responce (I used tcpdump to see what is returned, looks like a valid XML with methodResponce). Any idea what is wrong and how this can be fixed? Thanks, Alexander

On Wed, Jul 21, 2010 at 1:19 AM, Alexander Kotelnikov
Hello.
I decided to run a couple of test XML-RPC applications using haxr.
Everything worked fine while responces from my (actually, other people's) server were something relatively small (a number, a line), but with larger responces (starting around couple of kilobytes) my applications began to fail with the error I put into subject.
Sounds like XML parsing problem. Though server gives a proper responce (I used tcpdump to see what is returned, looks like a valid XML with methodResponce).
Any idea what is wrong and how this can be fixed?
Thanks, Alexander
Sending off to the maintainer of haxr, although it looks like it might be in HaXml (from an outside guess). Antoine

Antoine Latter
Sending off to the maintainer of haxr, although it looks like it might be in HaXml (from an outside guess).
Without some real example to look at it will be quite tough to proceed. Alexander, can you send that stream of packets to me? -- Gracjan

Judging solely by the error message (non-exhaustive patterns in 'white'), it sounds like it could be a bug in HaXml that was fixed in a patch of April 2009. Try using a more recent release of HaXml. Regards, Malcolm

On Wed, 21 Jul 2010 01:40:08 -0700 (PDT) "mw" == malcolm wallace
wrote: mw> mw> Judging solely by the error message (non-exhaustive patterns in mw> 'white'), it sounds like it could be a bug in HaXml that was fixed mw> in a patch of April 2009. Try using a more recent release of mw> HaXml.
Ouch... I check the version and realized that Debian/unstable has
version 1.13 of haxml.
Malcolm, can you comment this Debian changelog entry with which Debian
package was downgraded from 1.19 to 1.13:
haxml (1:1.13.3-1) unstable; urgency=low
* Switch back to the latest stable release of haxml, as to not break its
reverse build dependencies
* Thus do not depend on polyparse, remove patch adjusting the polyparse
dependency.
* Remove patches/09_fix-lexical-error, does not apply to this version of
HaXml
-- Joachim Breitner

Ouch... I check the version and realized that Debian/unstable has version 1.13 of haxml.
Malcolm, can you comment this Debian changelog entry with which Debian package was downgraded from 1.19 to 1.13:
I know nothing about Debian packaging, but it sounds like there are other packages that depend on the old version of HaXml, which have not yet been updated to use the current, slightly modified, API. Since the new API has been available for about 4 years now, and officially stable for the last six months (although in fact it changed very little in those four years), I think it is high time those other packages were updated. Regards, Malcolm

So updated to HaXml 1.20, haxr 3000.7 Simple calls (which deal with simple data types as integer or regular string) still work. Calls which successfully returned some binary data before do not do so anymore. The error is: Prelude.chr: bad argument: 1177427 Calls which complained about 'white' function now fail with: precondition not satisfied: Posn.white c | isSpace c My guess is that XML parser is not ready (and from XML standpoint it might be right) that XML-RPC tries to transfer binary data as its <string>. Alexander
On Wed, 21 Jul 2010 06:04:58 -0700 (PDT) "mw" == malcolm wallace
wrote: mw> mw> Ouch... I mw> check the version and realized that mw> Debian/unstable has version mw> 1.13 of haxml. mw> Malcolm, can you comment this Debian mw> changelog entry with which Debian package mw> was downgraded from 1.19 to 1.13: mw> mw> mw> I know nothing about Debian packaging, but it sounds like there are other packages that depend on mw> the old version of HaXml, which have not yet been updated to use the current, slightly modified, mw> API. Since the new API has been available for about 4 years now, and officially stable for the mw> last six months (although in fact it changed very little in those four years), I think it is high mw> time those other packages were updated. mw> Regards, mw> Malcolm

Calls which successfully returned some binary data before do not do so anymore. The error is: Prelude.chr: bad argument: 1177427
I can't help with this one. As Gracjan noted, it is probably because your binary data is not valid as UTF-8 text.
Calls which complained about 'white' function now fail with: precondition not satisfied: Posn.white c | isSpace c
But this one, although likely another symptom of the same binary problem, I have fixed in the darcs repo for HaXml. (Basically, the 'white' function was only permitting ASCII whitespace - I have now extended it to allow for Unicode whitespace characters also.) Regards, Malcolm

On Wed, 21 Jul 2010 06:46:26 +0000 (UTC) "GP" == Gracjan Polak
wrote: GP> GP> Antoine Latter writes: Sending off to the maintainer of haxr, although it looks like it might be in HaXml (from an outside guess). GP> GP> Without some real example to look at it will be quite tough to proceed. GP> GP> Alexander, can you send that stream of packets to me?
I attach a stream dump. -- Alexander Kotelnikov Saint-Petersburg, Russia

Alexander Kotelnikov
On Wed, 21 Jul 2010 06:46:26 +0000 (UTC) "GP" == Gracjan Polak
wrote: GP> GP> Antoine Latter writes: Sending off to the maintainer of haxr, although it looks like it might be in HaXml (from an outside guess). GP> GP> Without some real example to look at it will be quite tough to proceed. GP> GP> Alexander, can you send that stream of packets to me? I attach a stream dump.
Attachment (poster.dump): application/octet-stream, 2916 bytes
My guess at this point: Your XML contains PNG as binary data. Since this part is interpreted as a string with UTF-8 encoding we have big trouble here. Some of byte combinations in PNG do not constitute correct coding points, are probably converted/normalized and are interpreted as invalid XML. Solution: use text-based encoding for binary data. Base64 seems to be obvius candidate here. -- Gracjan
participants (5)
-
Alexander Kotelnikov
-
Antoine Latter
-
Gracjan Polak
-
Malcolm Wallace
-
malcolm.wallace