Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
mr-c opened this issue Sep 13, 2019 · 5 comments · May be fixed by #54
Open

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

mr-c opened this issue Sep 13, 2019 · 5 comments · May be fixed by #54

Comments

@mr-c
Copy link
Contributor

mr-c commented Sep 13, 2019

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?

@jxtx
Copy link
Contributor

jxtx commented Sep 17, 2019

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?

@rsharris
Copy link
Contributor

rsharris commented Sep 17, 2019 via email

@mr-c
Copy link
Contributor Author

mr-c commented Nov 7, 2019

@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

@rsharris
Copy link
Contributor

rsharris commented Nov 7, 2019

( 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.

@mr-c mr-c linked a pull request Dec 18, 2019 that will close this issue
@mr-c
Copy link
Contributor Author

mr-c commented Dec 18, 2019

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

@mr-c mr-c mentioned this issue Dec 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants