Bug 2416984

Summary: bmap-tools fails to build with Python 3.15: bmaptool.BmapCopy.Error: checksum mismatch for blocks range 34-35
Product: [Fedora] Fedora Reporter: Karolina Surma <ksurma>
Component: bmap-toolsAssignee: Davide Cavalca <davide>
Status: NEW --- QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: davide, ksurma, mhroncok, slewsys
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: ---
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 2412434    

Description Karolina Surma 2025-11-25 10:40:37 UTC
bmap-tools fails to build with Python 3.15.0a2.

_____________________________ TestCreateCopy.test ______________________________

self = <tests.test_api_base.TestCreateCopy testMethod=test>

    def test(self):  # pylint: disable=R0201
        """
        The test entry point. Executes the '_do_test()' function for files of
        different sizes, holes distribution and format.
        """
    
        # Delete all the test-related temporary files automatically
        delete = True
        # Create all the test-related temporary files in current directory
        directory = "."
    
        iterator = helpers.generate_test_files(delete=delete, directory=directory)
        for f_image, image_size, _, _ in iterator:
            assert image_size == os.path.getsize(f_image.name)
>           _do_test(f_image.name, image_size, delete=delete)

tests/test_api_base.py:283: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
tests/test_api_base.py:197: in _do_test
    helpers.copy_and_verify_image(
tests/helpers.py:304: in copy_and_verify_image
    writer.copy(bool(random.getrandbits(1)), bool(random.getrandbits(1)))
../BUILDROOT/usr/lib/python3.15/site-packages/bmaptool/BmapCopy.py:716: in copy
    raise exc_info[1]
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <bmaptool.BmapCopy.BmapCopy object at 0x7fa06d31d940>, verify = True

    def _get_data(self, verify):
        """
        This is generator  which reads the image file in '_batch_blocks' chunks
        and yields ('type', 'start', 'end',  'buf) tuples, where:
          * 'start' is the starting block number of the batch;
          * 'end' is the last block of the batch;
          * 'buf' a buffer containing the batch data.
        """
    
        _log.debug("the reader thread has started")
        try:
            for first, last, chksum in self._get_block_ranges():
                if verify and chksum:
                    hash_obj = hashlib.new(self._cs_type)
    
                self._f_image.seek(first * self.block_size)
    
                iterator = self._get_batches(first, last)
                for start, end, length in iterator:
                    try:
                        buf = self._f_image.read(length * self.block_size)
                    except IOError as err:
                        raise Error(
                            "error while reading blocks %d-%d of the "
                            "image file '%s': %s" % (start, end, self._image_path, err)
                        )
    
                    if not buf:
                        _log.debug(
                            "no more data to read from file '%s'", self._image_path
                        )
                        self._batch_queue.put(None)
                        return
    
                    if verify and chksum:
                        hash_obj.update(buf)
    
                    blocks = (len(buf) + self.block_size - 1) // self.block_size
                    _log.debug(
                        "queueing %d blocks, queue length is %d"
                        % (blocks, self._batch_queue.qsize())
                    )
    
                    self._batch_queue.put(("range", start, start + blocks - 1, buf))
    
                if verify and chksum and hash_obj.hexdigest() != chksum:
>                   raise Error(
                        "checksum mismatch for blocks range %d-%d: "
                        "calculated %s, should be %s (image file %s)"
                        % (first, last, hash_obj.hexdigest(), chksum, self._image_path)
                    )
E                   bmaptool.BmapCopy.Error: checksum mismatch for blocks range 34-35: calculated 4a69ab27664a141c049a10cb1cf7e85f99128eddfbe557a32d20afc8fcd472f9, should be 9f1dcbc35c350d6027f98be0f5c8b43b42ca52b7604459c0c42be3aa88913d47 (image file /builddir/build/BUILD/bmap-tools-3.9.0-build/bmaptool-3.9.0/sparse_oppjcfn5.img)

../BUILDROOT/usr/lib/python3.15/site-packages/bmaptool/BmapCopy.py:661: Error
=========================== short test summary info ============================
FAILED tests/test_api_base.py::TestCreateCopy::test - bmaptool.BmapCopy.Error...
=================== 1 failed, 13 passed, 8 skipped in 7.92s ====================

https://docs.python.org/3.15/whatsnew/3.15.html

For the build logs, see:
https://copr-be.cloud.fedoraproject.org/results/@python/python3.15/fedora-rawhide-x86_64/09825184-bmap-tools/

For all our attempts to build bmap-tools with Python 3.15, see:
https://copr.fedorainfracloud.org/coprs/g/python/python3.15/package/bmap-tools/

Testing and mass rebuild of packages is happening in copr.
You can follow these instructions to test locally in mock if your package builds with Python 3.15:
https://copr.fedorainfracloud.org/coprs/g/python/python3.15/

Let us know here if you have any questions.

Python 3.15 is planned to be included in Fedora 45.
To make that update smoother, we're building Fedora packages with all pre-releases of Python 3.15.
A build failure prevents us from testing all dependent packages (transitive [Build]Requires),
so if this package is required a lot, it's important for us to get it fixed soon.

We'd appreciate help from the people who know this package best,
but if you don't want to work on this now, let us know so we can try to work around it on our side.

Comment 1 Andrew L. Moore 2025-11-28 02:01:26 UTC
With Python v3.15.0a2+, I'm not able to reproduce this using `python -m unittest':

...
Ran 22 tests in 180.173s

OK (skipped=8)
$ python --version
Python 3.15.0a2+
$ bmaptool --version
bmaptool 3.9.0
$