[Zodb-checkins] CVS: ZODB3/ZODB - FileStorage.py:1.111

Jeremy Hylton jeremy@zope.com
Mon, 4 Nov 2002 17:01:01 -0500


Update of /cvs-repository/ZODB3/ZODB
In directory cvs.zope.org:/tmp/cvs-serv3643

Modified Files:
	FileStorage.py 
Log Message:
Apparent fix for George Bailey events.

It looks like a bogus file position (0) was getting passed to
_getVersion(), which was returning random data for the version.

XXX Need to review this patch carefully to see why the problem was
never noticed before.  Need to add a GB unit test.


=== ZODB3/ZODB/FileStorage.py 1.110 => 1.111 ===
--- ZODB3/ZODB/FileStorage.py:1.110	Fri Oct 18 20:04:37 2002
+++ ZODB3/ZODB/FileStorage.py	Mon Nov  4 17:01:00 2002
@@ -1048,6 +1048,7 @@
         read=self._file.read
         h=read(DATA_HDR_LEN)
         doid,serial,sprev,stloc,vlen,splen = unpack(DATA_HDR, h)
+        assert doid == oid
         if vlen:
             h=read(16)
             return read(vlen), h[:8]
@@ -1102,7 +1103,10 @@
                     # LoadBack gave us a key error. Bail.
                     raise UndoError
 
-        version, snv = self._getVersion(oid, pre)
+        if pre:
+            version, snv = self._getVersion(oid, pre)
+        else:
+            version, snv = '', ''
         if copy:
             # we can just copy our previous-record pointer forward
             return '', pre, version, snv, ipos
@@ -2386,7 +2390,6 @@
             prev = U64(sprev)
             tloc = U64(stloc)
             plen = U64(splen)
-
             dlen = DATA_HDR_LEN + (plen or 8)
 
             if vlen: