Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 746836 - dev-lua/lua-bit32-5.3.5: fails test (tests/test-bit32.lua:6: assertion failed!)
Summary: dev-lua/lua-bit32-5.3.5: fails test (tests/test-bit32.lua:6: assertion failed!)
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Azamat H. Hackimov
URL: https://github.com/keplerproject/lua-...
Whiteboard:
Keywords: TESTFAILURE
Depends on:
Blocks: 746785
  Show dependency tree
 
Reported: 2020-10-06 04:30 UTC by Sam James
Modified: 2020-10-10 15:31 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
build.log (file_746836.txt,2.08 KB, text/plain)
2020-10-06 04:30 UTC, Sam James
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Sam James archtester Gentoo Infrastructure gentoo-dev Security 2020-10-06 04:30:28 UTC
Created attachment 663922 [details]
build.log

>>> Test phase: dev-lua/lua-bit32-5.3.5
lua: tests/test-bit32.lua:6: assertion failed!
stack traceback:
        [C]: in function 'assert'
        tests/test-bit32.lua:6: in main chunk
        [C]: ?

----
Portage 3.0.7 (python 3.7.9-final-0, default/linux/arm/17.0/armv7a, gcc-9.3.0, glibc-2.32-r1, 5.4.0-1018-aws armv8l)
=================================================================
System uname: Linux-5.4.0-1018-aws-armv8l-ARMv8_Processor_rev_3_-v8l-with-gentoo-2.7
KiB Mem:    15825148 total,   4606008 free
KiB Swap:          0 total,         0 free
Timestamp of repository gentoo: Wed, 30 Sep 2020 02:30:01 +0000
Head commit of repository gentoo: 3d70680747d1f223b52a6508c4031aac655634b0
sh bash 5.0_p18
ld GNU ld (Gentoo 2.34 p6) 2.34.0
app-shells/bash:          5.0_p18::gentoo
dev-java/java-config:     2.3.1::gentoo
dev-lang/perl:            5.30.3-r1::gentoo
dev-lang/python:          2.7.18-r3::gentoo, 3.6.12::gentoo, 3.7.9::gentoo, 3.8.5::gentoo, 3.9.0_rc1::gentoo
dev-util/cmake:           3.18.2::gentoo
sys-apps/baselayout:      2.7::gentoo
sys-apps/openrc:          0.42.1::gentoo
sys-apps/sandbox:         2.20::gentoo
sys-devel/autoconf:       2.13-r1::gentoo, 2.69-r5::gentoo
sys-devel/automake:       1.16.2::gentoo
sys-devel/binutils:       2.34-r2::gentoo
sys-devel/gcc:            9.3.0-r1::gentoo, 10.2.0-r1::gentoo
sys-devel/gcc-config:     2.3.2::gentoo
sys-devel/libtool:        2.4.6-r6::gentoo
sys-devel/make:           4.3::gentoo
sys-kernel/linux-headers: 5.8::gentoo (virtual/os-headers)
sys-libs/glibc:           2.32-r1::gentoo
Repositories:

gentoo
    location: /var/db/repos/gentoo
    sync-type: rsync
    sync-uri: rsync://rsync.gentoo.org/gentoo-portage
    priority: -1000
    sync-rsync-extra-opts:
    sync-rsync-verify-metamanifest: yes
    sync-rsync-verify-max-age: 24
    sync-rsync-verify-jobs: 1

ACCEPT_KEYWORDS="arm ~arm"
ACCEPT_LICENSE="@FREE"
CBUILD="armv7a-unknown-linux-gnueabihf"
CFLAGS="-O2 -pipe -march=armv7-a -mfpu=vfpv3-d16 -mfloat-abi=hard"
CHOST="armv7a-unknown-linux-gnueabihf"
CONFIG_PROTECT="/etc /usr/share/config /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-O2 -pipe -march=armv7-a -mfpu=vfpv3-d16 -mfloat-abi=hard"
DISTDIR="/var/cache/distfiles"
EMERGE_DEFAULT_OPTS="--keep-going --complete-graph --with-bdeps=y"
ENV_UNSET="CARGO_HOME DBUS_SESSION_BUS_ADDRESS DISPLAY GOBIN GOPATH PERL5LIB PERL5OPT PERLPREFIX PERL_CORE PERL_MB_OPT PERL_MM_OPT XAUTHORITY XDG_CACHE_HOME XDG_CONFIG_HOME XDG_DATA_HOME XDG_RUNTIME_DIR"
FCFLAGS="-O2 -pipe -march=armv7-a -mfpu=vfpv3-d16 -mfloat-abi=hard"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync multilib-strict network-sandbox news parallel-fetch pid-sandbox preserve-libs protect-owned qa-unresolved-soname-deps sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe -march=armv7-a -mfpu=vfpv3-d16 -mfloat-abi=hard"
GENTOO_MIRRORS="http://distfiles.gentoo.org"
LANG="C.UTF8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
PKGDIR="/var/cache/binpkgs"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git"
PORTAGE_TMPDIR="/var/tmp"
USE="X acl arm asm berkdb bzip2 caps cli crypt dbus dri elogind eselect-ldso filecaps fortran gdbm gmp iconv ipv6 jit libglvnd ncurses nls nptl openmp pam pcre polkit readline seccomp split-usr ssl tcpd threads unicode xattr zlib" ADA_TARGET="gnat_2018" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="karbon sheets words" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_ARM="edsp thumb thumb2 v4 v5 v6 v7 vfp" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock greis isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" INPUT_DEVICES="libinput" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php7-2 php7-3 php7-4" POSTGRES_TARGETS="postgres10 postgres11" PYTHON_SINGLE_TARGET="python3_7" PYTHON_TARGETS="python2_7 python3_7 python3_6 python3_8 python3_9" RUBY_TARGETS="ruby25 ruby26" USERLAND="GNU" VIDEO_CARDS="dummy fbdev" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  CC, CPPFLAGS, CTARGET, CXX, INSTALL_MASK, LC_ALL, LINGUAS, MAKEOPTS, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 1 Conrad Kostecki gentoo-dev 2020-10-06 19:12:23 UTC
Any ideas why tests fail on arm?
Comment 2 Azamat H. Hackimov 2020-10-06 20:29:08 UTC
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.
Comment 3 Azamat H. Hackimov 2020-10-06 20:32:19 UTC
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))
Comment 4 Conrad Kostecki gentoo-dev 2020-10-06 20:48:35 UTC
@Sam: Could you give a shot? I either don't have arm :/
Comment 5 Conrad Kostecki gentoo-dev 2020-10-07 20:29:19 UTC
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?
Comment 6 Conrad Kostecki gentoo-dev 2020-10-09 23:11:22 UTC Comment hidden (obsolete)
Comment 7 Conrad Kostecki gentoo-dev 2020-10-09 23:12:03 UTC
(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?
Comment 8 Conrad Kostecki gentoo-dev 2020-10-10 00:18:31 UTC
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.
Comment 9 Conrad Kostecki gentoo-dev 2020-10-10 00:22:55 UTC
Could be this related to Gentoos Lua?
Ubuntu 18.04.5 i386 works fine with Lua 5.1 and bit32.
Comment 10 Conrad Kostecki gentoo-dev 2020-10-10 01:03:44 UTC
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.
Comment 11 Conrad Kostecki gentoo-dev 2020-10-10 01:30:54 UTC
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?
Comment 12 Conrad Kostecki gentoo-dev 2020-10-10 01:58:41 UTC
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?
Comment 13 Conrad Kostecki gentoo-dev 2020-10-10 02:10:20 UTC
@Azamat: Maybe you could at least for now the luacompat52 variant, which works?
Comment 14 Conrad Kostecki gentoo-dev 2020-10-10 10:41:33 UTC Comment hidden (obsolete)
Comment 15 Conrad Kostecki gentoo-dev 2020-10-10 10:47:39 UTC
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.
Comment 16 Conrad Kostecki gentoo-dev 2020-10-10 15:10:09 UTC
Upstream fixed it! It's a bug, which affects all 32bit systems.
Will push patch, add keywords and close here.
Comment 17 Larry the Git Cow gentoo-dev 2020-10-10 15:31:29 UTC
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(+)