Tarantool development patches archive
 help / color / mirror / Atom feed
From: Igor Munkin <imun@tarantool.org>
To: imeevma@tarantool.org
Cc: tarantool-patches@dev.tarantool.org
Subject: Re: [Tarantool-patches] [PATCH v2 1/1] lua/serializer: encode Lua number -2^63 as integer
Date: Thu, 19 Dec 2019 00:42:10 +0300	[thread overview]
Message-ID: <20191218214210.GX1214@tarantool.org> (raw)
In-Reply-To: <0e3de775c20f0e5776301a5b39fa1e22e0e8bdb7.1576060409.git.imeevma@gmail.com>

Mergen,

Thanks, the changes are totally LGTM. However, please consider the side
note I left below (I expect no changes in patch regarding it).

Cced Kirill to proceed with with the patch.

On 11.12.19, imeevma@tarantool.org wrote:

<snipped>

> 
> New patch:
> 
> From 0e3de775c20f0e5776301a5b39fa1e22e0e8bdb7 Mon Sep 17 00:00:00 2001
> From: Mergen Imeev <imeevma@gmail.com>
> Date: Fri, 6 Dec 2019 19:22:40 +0300
> Subject: [PATCH] lua/serializer: encode Lua number -2^63 as integer
> 
> This patch fixes a bug that appeared after commit
> 3a13be1de38e79b6b7e0e7a6fa81f4c59c379f4e ('lua: fix lua_tofield()
> for 2**64 value') .
> 
> Due to this bug, -2^63 was serialized as double, although it
> should be serialized as integer.
> 
> Closes #4672
> 

<snipped>

> +
> +    -- gh-4672: Make sure that -2^63 encoded as INTEGER.
> +    test:ok(s.encode(-9223372036854775808LL) == s.encode(-2^63),
> +            '-2^63 encoded as INTEGER')

Side note: After applying the following diff on your patch, tests are
still fine.
| diff --git a/test/app-tap/lua/serializer_test.lua b/test/app-tap/lua/serializer_test.lua
| index 038559756..7d3f62109 100644
| --- a/test/app-tap/lua/serializer_test.lua
| +++ b/test/app-tap/lua/serializer_test.lua
| @@ -145,7 +145,7 @@ local function test_signed(test, s)
|      rt(test, s, ffi.new('int', -128), 'number')
|
|      -- gh-4672: Make sure that -2^63 encoded as INTEGER.
| -    test:ok(s.encode(-9223372036854775808LL) == s.encode(-2^63),
| +    test:ok(s.encode(-9223372036854775808LL) == s.encode(-2^63 - 1),
|              '-2^63 encoded as INTEGER')
|  end
Yep, it's double precision issue, and we can do nothing here, but I
guess it ought to be well-documented, taking into account the patch
you've made.

-- 
Best regards,
IM

  parent reply	other threads:[~2019-12-18 21:44 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-11 10:49 imeevma
2019-12-18  1:34 ` Alexander Turenko
2019-12-18 21:42 ` Igor Munkin [this message]
2019-12-19 12:34   ` Mergen Imeev
2019-12-19 11:06 ` Kirill Yukhin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191218214210.GX1214@tarantool.org \
    --to=imun@tarantool.org \
    --cc=imeevma@tarantool.org \
    --cc=tarantool-patches@dev.tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH v2 1/1] lua/serializer: encode Lua number -2^63 as integer' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox