DeprecationWarning in gzip.py causes make check-dist-tarball to fail on Python 2.6

Bug #387139 reported by Jonathan Lange
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Bazaar
Fix Released
High
Martin Pool

Bug Description

make check-dist-tarball fails with this error when run on a system with python2.6 as the default:

======================================================================
ERROR: test_filenames (bzrlib.tests.test_multiparent.TestMultiVersionedFile)

vvvv[log from bzrlib.tests.test_multiparent.TestMultiVersionedFile.test_filenames]
1068.606 opening working tree '/tmp/testbzr-9V8eOp.tmp'

^^^^[log from bzrlib.tests.test_multiparent.TestMultiVersionedFile.test_filenames]
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/tmp/tmp_bzr_check_dist.MRBDNZBclG/bzr-1.16rc1/bzrlib/tests/test_multiparent.py", line 268, in test_filenames
    vf.add_version('a\nb\nc\nd'.splitlines(True), 'a', [])
  File "/tmp/tmp_bzr_check_dist.MRBDNZBclG/bzr-1.16rc1/bzrlib/multiparent.py", line 365, in add_version
    self.add_diff(diff, version_id, parent_ids)
  File "/tmp/tmp_bzr_check_dist.MRBDNZBclG/bzr-1.16rc1/bzrlib/multiparent.py", line 573, in add_diff
    zipfile.close()
  File "/usr/lib/python2.6/gzip.py", line 313, in close
    write32u(self.fileobj, self.crc)
  File "/usr/lib/python2.6/gzip.py", line 21, in write32u
    output.write(struct.pack("<L", value))
DeprecationWarning: struct integer overflow masking is deprecated

----------------------------------------------------------------------
Ran 14646 tests in 1063.068s

Related branches

Revision history for this message
Martin Pool (mbp) wrote :

It seems like we should (probably in the bzr script) be masking out warnings from libraries known to not be up to date with the Python interpreter.

Changed in bzr:
importance: Undecided → High
status: New → Confirmed
summary: - make check-dist-tarball fails with Python 2.6
+ DeprecationWorning in gzip.py causes make check-dist-tarball to fail on
+ Python 2.6
Revision history for this message
Robert Collins (lifeless) wrote : Re: DeprecationWorning in gzip.py causes make check-dist-tarball to fail on Python 2.6

Ugh, thats just nasty (python 2.6's own code spitting out deprecations like that). Agreed on us masking this out.

Revision history for this message
Martin Pool (mbp) wrote :

Biting me too trying to test one of my branches

Changed in bzr:
assignee: nobody → Martin Pool (mbp)
status: Confirmed → In Progress
Revision history for this message
John A Meinel (jameinel) wrote :

I'm pretty sure this is python2.6 + 64-bit system.

I'm not positive, but I would guess that the "<L" is defined as a 32-bit op, but "value" is a PyInt which is a 64-bit object.

That, and if it is a crc32, then it is an 'unsigned' 32-bit value, stored in a 64-bit int. Which on 32-bit is exposed as a 32-bit *signed* integer (and thus wouldn't fail the check), but on 64-bit it shows up as a signed *64-bit* integer which can hold a 32-bit unsigned integer just fine.

I'm concerned that gzip.py might be broken on 64-bit. My first guess is that it isn't or it would have shown up for people a while ago. (It is warning because functionality may change in the future, but for now it is still encoding all 32-bits into the output, *without* truncating oddly because of signed/unsigned issues.)

Anyway, as long as it is correct, suppressing the error seems reasonable.

Revision history for this message
Martin Pool (mbp) wrote :

I think the warning means "this works, but it won't work in 2.7", so we just need to hope they fix it before then.

Revision history for this message
Martin Pool (mbp) wrote :

With that particular warning masked off, we also get this, which seems almost equivalent. I don't know if struct.py is raising both one after the other...

^^^^[log from bzrlib.tests.test_multiparent.TestMultiVersionedFile.test_save_load]
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/mbp/bzr/387139-warnings/bzrlib/tests/test_multiparent.py", line 258, in test_save_load
    vf.add_version('a\nb\nc\nd'.splitlines(True), 'a', [])
  File "/home/mbp/bzr/387139-warnings/bzrlib/multiparent.py", line 365, in add_version
    self.add_diff(diff, version_id, parent_ids)
  File "/home/mbp/bzr/387139-warnings/bzrlib/multiparent.py", line 573, in add_diff
    zipfile.close()
  File "/usr/lib/python2.6/gzip.py", line 313, in close
    write32u(self.fileobj, self.crc)
  File "/usr/lib/python2.6/gzip.py", line 21, in write32u
    output.write(struct.pack("<L", value))
DeprecationWarning: 'L' format requires 0 <= number <= 4294967295

Revision history for this message
Martin Pool (mbp) wrote :

Fix for at least this one warning in the attached branch

Changed in bzr:
status: In Progress → Fix Committed
summary: - DeprecationWorning in gzip.py causes make check-dist-tarball to fail on
+ DeprecationWarning in gzip.py causes make check-dist-tarball to fail on
Python 2.6
Revision history for this message
Martin Pool (mbp) wrote :

Sent to pqm

Martin Pool (mbp)
Changed in bzr:
status: Fix Committed → Fix Released
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.