[Zope-Checkins] CVS: Packages/ZODB - fsrecover.py:1.12.6.2

Tim Peters tim.one at comcast.net
Mon Jul 18 11:30:06 EDT 2005


Update of /cvs-repository/Packages/ZODB
In directory cvs.zope.org:/tmp/cvs-serv30303/ZODB

Modified Files:
      Tag: Zope-2_7-branch
	fsrecover.py 
Log Message:
Collector #1846:  If an uncommitted transaction was found, fsrecover.py
fell into an infinite loop.  It also referenced an undefined global.
Fixed that, and added a new test (testUncommittedAtEnd) to ensure this
stays fixed.


=== Packages/ZODB/fsrecover.py 1.12.6.1 => 1.12.6.2 ===
--- Packages/ZODB/fsrecover.py:1.12.6.1	Mon Sep 15 17:26:56 2003
+++ Packages/ZODB/fsrecover.py	Mon Jul 18 11:29:36 2005
@@ -114,7 +114,7 @@
         error("time-stamp reducation %s < %s, at %s", u64(tid), u64(ltid), pos)
 
     if status == "c":
-        truncate(f, pos, file_size, output)
+        truncate(f, pos, file_size, outp)
         raise EOFError
 
     if status not in " up":
@@ -156,12 +156,18 @@
 def truncate(f, pos, file_size, outp):
     """Copy data from pos to end of f to a .trNNN file."""
 
+    # _trname is global so that the test suite can know the path too (in
+    # order to delete the file when the test ends).
+    global _trname
+
     i = 0
     while 1:
-        trname = outp + ".tr%d" % i
-        if os.path.exists(trname):
+        _trname = outp + ".tr%d" % i
+        if os.path.exists(_trname):
             i += 1
-    tr = open(trname, "wb")
+        else:
+            break
+    tr = open(_trname, "wb")
     copy(f, tr, file_size - pos)
     f.seek(pos)
     tr.close()



More information about the Zope-Checkins mailing list