[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Idea: autopkgtest on big-endian for 'Architecture: all' packages to catch endian bugs



I recently packaged a Python module called sqlite-fts4 written by Simon
Willison. The package is pure Python, so is 'Architecture: all', but it
fails on big-endian architectures. The test suite catches this failure.

The bug was spotted by OpenSUSE because they tried to run the test suite on
s390x. They filed a bug which upstream has fixed.

https://github.com/simonw/sqlite-fts4/issues/6

Simon has written some posts about this problem.

https://til.simonwillison.net/python/struct-endianness
https://til.simonwillison.net/docker/emulate-s390x-with-qemu

It would be nice if the Debian infrastructure could catch this class of bug.

Building the sqlite-fts4 Debian package runs the test suite, and I've
configured it to run the tests via autopkgtest.

I tried building the sqlite-fts4 package with the bug on the s390x porterbox,
zelenka.debian.org. The tests catch the bug.

I wonder if it would be possible to routinely run the autopkgtests on s390x,
or another big-endian architecture, for 'Architecture: all' packages and make
the results available.

Has this been suggested or attempted before?

If you're curious this is the code with the bug:

 def decode_matchinfo(buf): 
     # buf is a bytestring of unsigned integers, each 4 bytes long 
     return struct.unpack("I" * (len(buf) // 4), buf) 

And the fix looks like this:

 def decode_matchinfo(buf):
     # buf is a bytestring of unsigned integers, each 4 bytes long
     return struct.unpack("@" + ("I" * (len(buf) // 4)), buf)

Cheers,
-- 
Edward


Reply to: