Skip to content

Exception: 2147483648 is larger than the maximum possible size (2147483647) #48

Open

Description

@mr-c

Hello,

Debian is not currently able to build bx-python on the armel, armhf, i386, mipsel architectures (amongst others) due to the following error:


======================================================================
ERROR: bx.interval_index_file_tests.test_interval_index_file
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/<<PKGBUILDDIR>>/.pybuild/cpython3_3.7_bx-python/build/bx/interval_index_file_tests.py", line 22, in test_interval_index_file
    ix.add( name, start, end, i, max=interval_index_file.MAX )
  File "/<<PKGBUILDDIR>>/.pybuild/cpython3_3.7_bx-python/build/bx/interval_index_file.py", line 276, in add
    self.indexes[name] = Index( max=max )
  File "/<<PKGBUILDDIR>>/.pybuild/cpython3_3.7_bx-python/build/bx/interval_index_file.py", line 346, in __init__
    self.new( min, max )
  File "/<<PKGBUILDDIR>>/.pybuild/cpython3_3.7_bx-python/build/bx/interval_index_file.py", line 364, in new
    self.offsets = offsets_for_max_size( max )
  File "/<<PKGBUILDDIR>>/.pybuild/cpython3_3.7_bx-python/build/bx/interval_index_file.py", line 136, in offsets_for_max_size
    raise Exception( "%d is larger than the maximum possible size (%d)" % ( max_size, BIN_OFFSETS_MAX[0] ) )
Exception: 2147483648 is larger than the maximum possible size (2147483647)

Example build log: https://buildd.debian.org/status/fetch.php?pkg=python-bx&arch=armel&ver=0.8.4-2&stamp=1564652009&raw=0

Should we skip this test for now?

Activity

  1. jxtx commented on Sep 17, 2019

    @jxtx
    Contributor

    Interesting. Is sys.maxsize == (2**31 - 1) on these platforms? We are probably making a bad assumption here:

    https://github.com/bxlab/bx-python/blob/master/lib/bx/interval_index_file.py#L126

    That should probably be sys.maxsize. Sanity check @rsharris?

  2. rsharris commented on Sep 17, 2019

    @rsharris
    Contributor
  3. mr-c commented on Nov 7, 2019

    @mr-c
    ContributorAuthor

    @rsharris @jxtx This is keeping the new versions of the package from Debian's testing distribution. Shall we skip these tests, or is there a real bug on the architectures that needs fixing?

    Re:

    Is sys.maxsize == (2**31 - 1) on these platforms?

    As @rsharris said, sys.maxsize is 2**63-1 on amd64, and 2**31-1 on i386, armel, armhf, and mipsel

  4. rsharris commented on Nov 7, 2019

    @rsharris
    Contributor

    ( Ignoring the confusion (which might only be mine) about whether BIN_OFFSETS_MAX[0] should be a power of 2. )

    My two cents:

    What I see is (a) a potential issue with a disagreement in field sizes, and (b) a potential issue of cross-platform portability.

    What I mean by field sizes ... fields are written to the file as ">I", but the expectation during design may have been that these were 32 bits. If ">I" is a different size on some platforms there's a potential for bugs. Looking at the code it seems to calculate everything using calcsize(), so maybe this isn't a problem.

    If, however, a file is written on a platform with one size ">I" and read on a platform with a different ">I", then obviously the whole thing will fail. I don't know whether those sizes vary on different platforms, but I expect that they would.

    It could be there's no intent to support cross-platform portability. If so, it seems like the size of ">I" should be indicated in the file header so that readers could reject files with the wrong ">I" size.

  5. mr-c commented on Dec 18, 2019

    @mr-c
    ContributorAuthor

    I made a PR making many of the changes suggested above at #54

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions