Re: [ZODB-Dev] zc.zodbdgc bug - undefined variable

2011-08-08 Thread Sylvain Viollon


  Hello,

Op 5 aug 2011, om 22:12 heeft Jim Fulton het volgende geschreven:

> On Fri, Aug 5, 2011 at 1:55 PM, Hanno Schlichting  wrote:
>> 
>> 
>> 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.
> 

  That's a very old Data.fs, from 2002, where we always upgraded the 
application without creating
  a new Data.fs. I think you have all the different format and case of pickling 
that the ZODB uses to
  encode references in it, I already got trouble because the Python pickle 
module have been cleaned
  in Python 2.6 of a specific ZODB hack. I fixed it with zodbupdate.

  I think that Data.fs is a pretty good test for any ZODB tool.

  Regards,

  Sylvain,

-- 
Sylvain Viollon -- Infrae
t +31 10 243 7051 -- http://infrae.com
Hoevestraat 10 3033GC Rotterdam -- The Netherlands



___
For more information about ZODB, see the ZODB Wiki:
http://www.zope.org/Wikis/ZODB/

ZODB-Dev mailing list  -  ZODB-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zodb-dev


Re: [ZODB-Dev] zc.zodbdgc bug - undefined variable

2011-08-05 Thread Jim Fulton
On Fri, Aug 5, 2011 at 1:55 PM, Hanno Schlichting  wrote:
> On Mon, Aug 1, 2011 at 6:26 PM, Sylvain Viollon  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 
>>    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
___
For more information about ZODB, see the ZODB Wiki:
http://www.zope.org/Wikis/ZODB/

ZODB-Dev mailing list  -  ZODB-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zodb-dev