[BUG] 0.15rc2: DeprecationWarning: struct integer overflow masking is deprecated

John Arbash Meinel john at arbash-meinel.com
Tue Mar 27 21:00:36 BST 2007


Jari Aalto+usenet wrote:
> * Mon 2007-03-26 John Arbash Meinel <john AT arbash-meinel.com>
>>> /usr/lib/python2.5/site-packages/bzrlib python -Werror /usr/bin/bzr status dirstate.py
>>> struct integer overflow masking is deprecated
>>> size : <type 'long'> 107912
>>> mtime: <type 'float'> 1174919444.0
>>> ctime: <type 'float'> 1174919444.0
>>> dev  : <type 'long'> 1085651769
>>> ino  : <type 'long'> 4336604776193321356
>>> mode : <type 'int'> 33188
>>> modified:
>>>   dirstate.py
>> Well, it is pretty clear that you have 64-bit inodes, and those aren't
>> going to fit in a 32-bit struct.pack.
> 
> That's interesting. I'm running w2kSp4, latest Cygwin.
> 
>> Now, there are 2 things we could do:
>>
>> 1) int(st.st_ino & 0xFFFFFFFF)
>> This would ignore the warning, at the potential of having a erroneous
>> cache hit. (If a files inode changed in the upper 32-bits, but the
>> mtime, ctime, size, etc did not)
>> The chance of that is pretty darn small, so I think it would be plenty
>> safe do do in the short term.
> 
> For the 0.15 release this would be welcomed, because I plan to package
> that for official Cygwin. If you cant be cautious, you could always
> test OS (envvar CYGWIN exists) and apply it for Cygwin only.
> 
>> 2) Longer term, I think we are going for "%lX.%lX...." as the
>> formatting, rather than base64.encode(struct.pack('>l...')). It seems to
>> be a bit faster to generate, can handle 64 bit entries, and scales down
>> to small entries, too. I think that is the proposed change for 0.16.
> 
> Sounds good.
> 
> Jari
> 
> 
> 

Can you confirm if the warning goes away with this change:
=== modified file 'bzrlib/dirstate.py'
--- bzrlib/dirstate.py  2007-03-26 12:26:11 +0000
+++ bzrlib/dirstate.py  2007-03-27 19:58:29 +0000
@@ -2369,6 +2369,6 @@
     # well within the noise margin

     # base64.encode always adds a final newline, so strip it off
-    return _encode(_pack('>llllll'
+    return _encode(_pack('>LLLLLL'
         , st.st_size, int(st.st_mtime), int(st.st_ctime)
-        , st.st_dev, st.st_ino, st.st_mode))[:-1]
+        , st.st_dev, st.st_ino & 0xFFFFFFFF, st.st_mode))[:-1]



John
=:->




More information about the bazaar mailing list