[erlang-patches] Fwd: Re: fixed reading compressed binary terms from Java

Raimo Niskanen raimo+erlang-patches@REDACTED
Fri May 11 15:00:24 CEST 2012


On Wed, May 09, 2012 at 11:52:18AM +0200, Nico Kruber wrote:
> forwarded to mailing list as the reply was only send to Henrik Nord...
> ----------  Forwarded Message  ----------
> 
> Subject: Re: [erlang-patches] fixed reading compressed binary terms from Java
> Date: Friday 04 May 2012, 16:37:55
> From: Nico Kruber <lists.nico.k@REDACTED>
> To: Henrik Nord <henrik@REDACTED>
> 
> Can you give me a hint on how to write and run tests your way?
> I could easily write a JUnit test for that and won't even need Erlang since 
> the only thing that needs testing here is that write_compressed and read_any 
> work with each other with differently sized values. You could even use 
> bytes/OtpErlangBinary for simplicity.
> 
> The only roundtrip test so far is the echo server, i.e. nc_SUITE.erl, which 
> currently only has small terms. I could add larger terms but I need some help 
> in how to actually run the test. It is not as simple as "make tests" (with the 
> proper ERL_TOP set).

Is this sufficient to get you started?:
    https://github.com/erlang/otp/wiki/Running-tests


> 
> 
> Nico
> 
> On Friday 27 April 2012 10:23:37 you wrote:
> > Hi
> > 
> > I would like you to add a test for this. As there already are compress
> > and decompress roundtrip tests,
> > the effort should be minimal for adding tests for this specific bug.
> > 
> > Also the commit message should conform to
> > (fix, not fixed etc..)
> > 
> > https://github.com/erlang/otp/wiki/Writing-good-commit-messages
> > 
> > Thank you for the contribution!
> > 
> > On 04/25/2012 10:48 AM, Nico Kruber wrote:
> > > Problem was that when reading from an InputStream, you can only specify a
> > > maximum number of bytes to read. Java doesn't guarantee that it actually
> > > reads this many bytes - it could be less!
> > > 
> > > This patch now reads up until the expected size number of bytes. If there
> > > are more than expected, the actual number of available bytes is not
> > > printed (we probably shouldn't read the additional bytes, security-wise -
> > > the erlang external byte representation is broken in this case though).
> > > 
> > > I applied a patch posted on erlang-questins in September 2009, see
> > > http://erlang.org/pipermail/erlang-patches/2009-September/000478.html
> > > It was not enough to fix the bug though so I extended this patch a little.
> > > 
> > > https://github.com/NicoK/otp/compare/jinterface.fix_compressed_binary
> > > https://github.com/NicoK/otp/compare/jinterface.fix_compressed_binary.patc
> > > h
> > > 
> > > 
> > > Regards
> > > Nico Kruber
> > > _______________________________________________
> > > erlang-patches mailing list
> > > erlang-patches@REDACTED
> > > http://erlang.org/mailman/listinfo/erlang-patches
> -----------------------------------------
> _______________________________________________
> erlang-patches mailing list
> erlang-patches@REDACTED
> http://erlang.org/mailman/listinfo/erlang-patches

-- 

/ Raimo Niskanen, Erlang/OTP, Ericsson AB



More information about the erlang-patches mailing list