Code using tuned_gzip may throw writing crc with Python 2.7

Bug #614476 reported by Martin Packman
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Bazaar
Fix Released
Medium
Martin Packman

Bug Description

On Python 2.7 the following tests fail:

    bt.test_knit.LowLevelKnitDataTests.test_multiple_records_valid
    bt.test_knit.LowLevelKnitDataTests.test_not_enough_lines
    bt.test_multiparent.TestMultiVersionedFile.test_filenames
    bt.test_multiparent.TestMultiVersionedFile.test_save_load

Errors are all along the lines of:

    Traceback (most recent call last):
      File ".\bzrlib\tests\test_knit.py", line 763, in test_not_enough_lines
        % (sha1sum,))
      File ".\bzrlib\tests\test_knit.py", line 697, in create_gz_content
        gz_file.close()
      File "...\python-trunk\lib\gzip.py", line 351, in close
        write32u(self.fileobj, self.crc)
      File "...\python-trunk\lib\gzip.py", line 22, in write32u
        output.write(struct.pack("<L", value))
    error: integer out of range for 'L' format code

The immediate cause is struct hasn't liked packing negative numbers into unsigned integers for a while, started issuing a deprecation warning in 2.5 and later just an error like the above.

This is only happening because of a later change to the gzip module, which tuned_gzip overrides some but not all parts of. For some reason a long standing fixup in the close method was removed and instead `& 0xffffffffL` was added after every call to zlib.crc32 instead:
<http://svn.python.org/view?view=rev&revision=61813>
<http://svn.python.org/view/python/branches/release27-maint/Lib/gzip.py?r1=61646&r2=61813>

I'm still not completely sure why this is being hit in 2.7 but apparently not in 2.6 where that change initially landed.

Repeating a whine, this bug need never have happened, had some plans been followed:
    >bzr blame --all --long bzrlib\tuned_gzip.py | grep upstream
    1641.1.1 <email address hidden> 20060407 | """Bzrlib specific gzip tunings. We plan to feed these to the upstream gzip."""

Tags: python27

Related branches

Revision history for this message
John A Meinel (jameinel) wrote :

Getting things upstream is not always trivial, and often gets forgotten. (And even if it *does* land, we can't use it because we support back to 2.4 which isn't updated anymore)

Changed in bzr:
importance: Undecided → Medium
status: New → Confirmed
Revision history for this message
John A Meinel (jameinel) wrote :

I should also note, 2.6 may indeed have broken these tests, but done so in say 2.6.5 or 2.6.6, and our test systems may only be running 2.6.4 (I know mine is).
I don't know any of that for sure, though.

Martin Packman (gz)
Changed in bzr:
assignee: nobody → Martin [gz] (gz)
milestone: none → 2.3b1
status: Confirmed → Fix Released
Martin Packman (gz)
tags: added: python27
removed: python2.7
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.