<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On 16 September 2014 21:06, Niko Tyni <span dir="ltr"><<a href="mailto:ntyni@debian.org" target="_blank">ntyni@debian.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">(Cc'ing Yves instead of the scary github address as he<br>
 explicitly asked for that in the upstream ticket.)<br>
<br></blockquote><div><br></div><div>Thanks. :-) </div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
On Wed, Jul 16, 2014 at 05:06:29PM +0200, gregor herrmann wrote:<br>
> On Tue, 15 Jul 2014 13:03:56 -0700, Yves Orton wrote:<br>
<br>
> > This is so frustrating. Is there anyone in the Debian community that knows<br>
> > these platforms that can help?<br>
><br>
> Hm, probably but I'm not sure who knows about all of them.<br>
> Cc'ing the Debian bug report.<br>
<br>
Hi, I looked at the Sereal-Encoder problems briefly. The current state<br>
with Debian libsereal-encoder-perl 3.002-1 (unpatched 3.002) is that it<br>
only fails on 64-bit big-endian architectures (s390x and powerpc64).<br>
<br>
The failures are all in t/700_roundtrip/ with the snappy tests, and<br>
involve array refs and long strings. I was able to reduce at least one<br>
of them to this:<br>
<br>
  #!/usr/bin/perl -w<br>
  use blib;<br>
  use Sereal::Decoder;<br>
  use Sereal::Encoder;<br>
  my $opt = { snappy => 1, use_protocol_v1 => 1};<br>
<br>
  my $len = shift || 509;<br>
<br>
  my $s="A"x$len;<br>
  my $e =  Sereal::Encoder->new($opt)->encode([$s, $s]);<br>
  my $d =  Sereal::Decoder->new($opt)->decode($e);<br>
<br>
  # print $e;<br>
  print "" . ($d->[0] eq $s ? "" : "not ") . "ok 1 first element\n";<br>
  print "" . ($d->[1] eq $s ? "" : "not ") . "ok 2 second element\n";<br>
<br>
which gives "not ok 2" on s390x when the length is 509 or greater.<br>
<br>
The problem is with the encoder: amd64 and s390x encoded contents differ,<br>
and feeding the amd64 encoded output to an s390x decoder works fine.<br>
The second element of the decoded array is just the string "3" in the<br>
incorrect case.<br>
<br></blockquote><div><br></div><div>Yes, indeed. Snappy is getting something wrong. </div><div><br></div><div>IIRC, prior to this patch:</div><div><div><br></div><div>commit 910842fc8aa3b9666926e2a40ad8f7c6d5e1c6d5</div><div>Author: Yves Orton <<a href="mailto:yves.orton@booking.com">yves.orton@booking.com</a>></div><div>Date:   Tue Jul 15 13:32:14 2014 +0200</div><div><br></div><div>    rework alignedness checks in Sereal code so that we do unaligned only on x86</div></div><div><br></div><div>Snappy did not work at all.</div><div><br></div><div><a href="https://github.com/Sereal/Sereal/commit/910842fc8aa3b9666926e2a40ad8f7c6d5e1c6d5">https://github.com/Sereal/Sereal/commit/910842fc8aa3b9666926e2a40ad8f7c6d5e1c6d5</a><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
I see the length of the encoded output shortens dramatically at the 508 -><br>
509 step, looks like some compression kicks in.<br>
<br>
I'm attaching the binary output from both s390x (incorrect) and amd64<br>
(correct) for reference for length==509. Hope they make it through,<br>
the md5sums should be<br>
<br>
 8787f3dd9a3bfa23bd91eb08c40f3716  509.amd64<br>
 276cbe59ce957915cc92b52fb0b7b51c  509.s390x<br>
<br>
All this makes me think that the problem is in snappy/csnappy_compress.c,<br>
but I haven't really delved into it yet.<br>
<br>
Hope this helps. Yves, please let me know if I can help in any way.<br></blockquote><div><br></div><div>Well I am wondering if you can look the patch I referenced above and see if you can work out what you need to do to get s390x to do the right thing? As you have identified yourself this is clearly a problem with the snappy support. But we pass test on other big-endian 64 bit platform as far as I understand (although I might be wrong).</div><div><br></div><div>I have CC'ed Jarkko as he did some of the work getting us to build properly on platforms with strict alignment and big-endian encodings.</div><div><br></div><div>Yves</div></div><div><br></div>-- <br>perl -Mre=debug -e "/just|another|perl|hacker/"
</div></div>