Commit cccb242e authored by Tim Peters's avatar Tim Peters

Merge rev 27186 from trunk.

FileIterator.next():  the code for reading the user, description,
and extension fields from a transaction was fatally confused,
usually reading them out of the object pickle by mistake.  This
caused several tools to display binary gibberish.
parent c5d49a10
...@@ -5,6 +5,10 @@ Release date: DD-MMM-YYYY ...@@ -5,6 +5,10 @@ Release date: DD-MMM-YYYY
Tools Tools
----- -----
FileStorage.FileIterator was confused about how to read a transaction's
user and description fields, which caused several tools to display
binary gibberish for these values.
ZODB.utils.oid_repr() changed to add a leading "0x", and to strip leading ZODB.utils.oid_repr() changed to add a leading "0x", and to strip leading
zeroes. This is used, e.g., in the detail of a POSKeyError exception, to zeroes. This is used, e.g., in the detail of a POSKeyError exception, to
identify the missing oid. Before, the output was ambiguous. For example, identify the missing oid. Before, the output was ambiguous. For example,
......
...@@ -1897,16 +1897,14 @@ class FileIterator(Iterator, FileStorageFormatter): ...@@ -1897,16 +1897,14 @@ class FileIterator(Iterator, FileStorageFormatter):
if h.status != "u": if h.status != "u":
pos = tpos + h.headerlen() pos = tpos + h.headerlen()
user = self._file.read(h.ulen)
description = self._file.read(h.dlen)
e = {} e = {}
if h.elen: if h.elen:
try: try:
e = loads(self._file.read(h.elen)) e = loads(h.ext)
except: except:
pass pass
result = RecordIterator(h.tid, h.status, user, description, result = RecordIterator(h.tid, h.status, h.user, h.descr,
e, pos, tend, self._file, tpos) e, pos, tend, self._file, tpos)
# Read the (intentionally redundant) transaction length # Read the (intentionally redundant) transaction length
...@@ -1966,16 +1964,20 @@ class RecordIterator(Iterator, BaseStorage.TransactionRecord, ...@@ -1966,16 +1964,20 @@ class RecordIterator(Iterator, BaseStorage.TransactionRecord,
# it go to the original data like BDBFullStorage? # it go to the original data like BDBFullStorage?
prev_txn = self.getTxnFromData(h.oid, h.back) prev_txn = self.getTxnFromData(h.oid, h.back)
r = Record(h.oid, h.tid, h.version, data, prev_txn) r = Record(h.oid, h.tid, h.version, data, prev_txn, pos)
return r return r
raise IndexError, index raise IndexError, index
class Record(BaseStorage.DataRecord): class Record(BaseStorage.DataRecord):
"""An abstract database record.""" """An abstract database record."""
def __init__(self, *args): def __init__(self, oid, tid, version, data, prev, pos):
self.oid, self.tid, self.version, self.data, self.data_txn = args self.oid = oid
self.tid = tid
self.version = version
self.data = data
self.data_txn = prev
self.pos = pos
class UndoSearch: class UndoSearch:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment