Summary: | dev-lua/lua-bit32-5.3.5: fails test (tests/test-bit32.lua:6: assertion failed!) | ||
---|---|---|---|
Product: | Gentoo Linux | Reporter: | Sam James <sam> |
Component: | Current packages | Assignee: | Azamat H. Hackimov <azamat.hackimov> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | conikost, proxy-maint, sam |
Priority: | Normal | Keywords: | TESTFAILURE |
Version: | unspecified | ||
Hardware: | All | ||
OS: | Linux | ||
URL: | https://github.com/keplerproject/lua-compat-5.3/issues/49 | ||
Whiteboard: | |||
Package list: | Runtime testing required: | --- | |
Bug Depends on: | |||
Bug Blocks: | 746785 | ||
Attachments: | build.log |
Description
Sam James
![]() ![]() ![]() ![]() Any ideas why tests fail on arm? Failed test is assert(bit32.bnot(0) == 2^32-1) which bit32.bnot(0) should be binary negation, so operation on zero should be FFFF FFFF or 4294967295. I suspect that on arm64 size of unsigned integer (lua_Unsigned) not 32 bit, but 64, so there maybe FFFF FFFF FFFF FFFF which not equal 2^32-1. I don't have arm64, so cannot test it. Quick check is run lua code on arm64 machine: lua test.lua test.lua: local bit32 bit32 = require("bit32") print(bit32.bnot(0)) @Sam: Could you give a shot? I either don't have arm :/ Hi! (In reply to Azamat H. Hackimov from comment #3) > I don't have arm64, so cannot test it. Quick check is run lua code on arm64 > machine: > > lua test.lua > > test.lua: > > local bit32 > bit32 = require("bit32") > print(bit32.bnot(0)) a friend of mine did run a test with lua5.2 and lua5.3: armhf: 4294967295 aarch64: 4294967295 And a test with lua5_1 and external bit32 module: armhf: 4294967295 He has no aarch64 system with lua5.1. @sam_c: Can you retest and confirm the same values? @Azamat: Maybe we can build a print in to see, what the test itself gets as max value? (In reply to Azamat H. Hackimov from comment #3) > I don't have arm64, so cannot test it. Quick check is run lua code on arm64 > machine: > > lua test.lua > > test.lua: > > local bit32 > bit32 = require("bit32") > print(bit32.bnot(0)) I did now a test on a arm amd64 machine. arm: fails, "print(bit32.bnot(0))" return -1. arm64: everything okay! Any idea for that? (In reply to Azamat H. Hackimov from comment #3) > I don't have arm64, so cannot test it. Quick check is run lua code on arm64 > machine: > > lua test.lua > > test.lua: > > local bit32 > bit32 = require("bit32") > print(bit32.bnot(0)) I did now a test on an arm and arm64 machine. arm: fails, "print(bit32.bnot(0))" return -1. arm64: everything okay! Any idea for that? There seems to be some sort of overflow? Limited to int32?
> print(bit32.bnot(2147483649))
> -2147483648
> print(bit32.bnot(-2147483649))
> 2147483647
@Azamat: I can reproduce on x86. It seems, that it always fails on 32bit, but works on 64bit.
Could be this related to Gentoos Lua? Ubuntu 18.04.5 i386 works fine with Lua 5.1 and bit32. It seems to be related, how lua-bit32 is being compiled. If I replace bit32.so with precompiled version from Ubuntu, everything works correctly on arm and x86. So there must be something different. I see a difference, I got fooled by the version number. Ubuntu ships 5.3.0, which is in fact "compat52", while 5.3.5 "compat53". Did maybe that broke compatibility? I just recompiled lua-compat-5.2-bitlib-5.3.0. All tests pass! This is also the version, which Ubuntu uses. So it seems for me, something is broken with lua-compat-5.3-bitlib-0.9.. @Azamat: any ideas? @Azamat: Maybe you could at least for now the luacompat52 variant, which works? Please have a look at https://github.com/ConiKost/gentoo/commit/9715e988f1cede0ceb617d403a827542d6761747 Are you fine with commiting that? All tests pass on amd64, arm, arm64 and x86. Please have a look at https://github.com/ConiKost/gentoo/commit/b02bae576d97030b786cffefcdfdd05df47f8157 Are you fine with commiting that? All tests pass on amd64, arm, arm64 and x86. Upstream fixed it! It's a bug, which affects all 32bit systems. Will push patch, add keywords and close here. The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=40c1d8ffaa7fb77a67d9f02cdd21c01bfaf76de4 commit 40c1d8ffaa7fb77a67d9f02cdd21c01bfaf76de4 Author: Conrad Kostecki <conikost@gentoo.org> AuthorDate: 2020-10-10 15:30:34 +0000 Commit: Conrad Kostecki <conikost@gentoo.org> CommitDate: 2020-10-10 15:30:34 +0000 dev-lua/lua-bit32: add ~arm and ~arm64 keywords After fixing 32bit conversion, we can finally add ~arm and ~arm64 keywords for this packge. This makes possible to use it by net-im/prosody. Closes: https://bugs.gentoo.org/746836 Package-Manager: Portage-3.0.8, Repoman-3.0.1 Signed-off-by: Conrad Kostecki <conikost@gentoo.org> dev-lua/lua-bit32/lua-bit32-5.3.5-r1.ebuild | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e8422e6bafceb04372c23a80d8ae636dfc588ec3 commit e8422e6bafceb04372c23a80d8ae636dfc588ec3 Author: Conrad Kostecki <conikost@gentoo.org> AuthorDate: 2020-10-10 15:27:26 +0000 Commit: Conrad Kostecki <conikost@gentoo.org> CommitDate: 2020-10-10 15:27:26 +0000 dev-lua/lua-bit32: drop old version Closes: https://bugs.gentoo.org/746836 Package-Manager: Portage-3.0.8, Repoman-3.0.1 Signed-off-by: Conrad Kostecki <conikost@gentoo.org> dev-lua/lua-bit32/lua-bit32-5.3.5.ebuild | 48 -------------------------------- 1 file changed, 48 deletions(-) https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4ad1abce782d98f32c7ba77d1c59f92f6417b2ff commit 4ad1abce782d98f32c7ba77d1c59f92f6417b2ff Author: Conrad Kostecki <conikost@gentoo.org> AuthorDate: 2020-10-10 15:26:26 +0000 Commit: Conrad Kostecki <conikost@gentoo.org> CommitDate: 2020-10-10 15:26:26 +0000 dev-lua/lua-bit32: fix 32bit conversion Running bit32 on 32bit systems was broken, so returned value was '-1'. Closes: https://bugs.gentoo.org/746836 Package-Manager: Portage-3.0.8, Repoman-3.0.1 Signed-off-by: Conrad Kostecki <conikost@gentoo.org> .../lua-bit32-5.3.5-fix-32bit-conversion.patch | 51 ++++++++++++++++++++++ dev-lua/lua-bit32/lua-bit32-5.3.5-r1.ebuild | 51 ++++++++++++++++++++++ 2 files changed, 102 insertions(+) |