[ZODB-Dev] zc.zodbdgc bug - undefined variable
Jim Fulton
jim at zope.com
Fri Aug 5 16:12:59 EDT 2011
On Fri, Aug 5, 2011 at 1:55 PM, Hanno Schlichting <hanno at hannosch.eu> wrote:
> On Mon, Aug 1, 2011 at 6:26 PM, Sylvain Viollon <sylvain at infrae.com> wrote:
>> However, if I run multi-check-gc, I get a Python error:
>>
>> Traceback (most recent call last):
>> File "./bin/multi-zodb-gc", line 210, in <module>
>> zc.zodbdgc.gc_command()
>> File "/Users/sylvain/Documents/debug-eggs/zc.zodbdgc-0.6.0-py2.7.egg/zc/zodbdgc/__init__.py", line 99, in gc_command
>> untransform=untransform, ptid=ptid)
>> File "/Users/sylvain/Documents/debug-eggs/zc.zodbdgc-0.6.0-py2.7.egg/zc/zodbdgc/__init__.py", line 105, in gc
>> return gc_(close, conf, days, ignore, conf2, fs, untransform, ptid)
>> File "/Users/sylvain/Documents/debug-eggs/zc.zodbdgc-0.6.0-py2.7.egg/zc/zodbdgc/__init__.py", line 220, in gc_
>> getrefs(data, name, ignore))
>> File "/Users/sylvain/Documents/debug-eggs/zc.zodbdgc-0.6.0-py2.7.egg/zc/zodbdgc/__init__.py", line 398, in insert
>> tid = max(tid, oldtid)
>> NameError: global name 'oldtid' is not defined
>>
>> Which is true, oldtid is not defined anywhere in this Python module.
>
> Indeed, in current trunk oldtid is used on line 398 and 400. Looking
> at the code I cannot tell if it's safe to just remove that code.
It is not. The bug is on line 395. It should be:
oldtid = f.read(8)
Of course, this needs to be verified with a test.
This seems to be a (obviously untested) case where
there are multiple records of a garbage object. I'll have to
ponder how this could actually happen.
Jim
--
Jim Fulton
http://www.linkedin.com/in/jimfulton
More information about the ZODB-Dev
mailing list