Commit fc8470e2 authored by Jim Fulton's avatar Jim Fulton

Fixed bug in new code that checked for packs to times earlier than

previous packs. Packs to earlier times can cause data lossage.
parent 667e6128
...@@ -184,7 +184,7 @@ ...@@ -184,7 +184,7 @@
# may have a back pointer to a version record or to a non-version # may have a back pointer to a version record or to a non-version
# record. # record.
# #
__version__='$Revision: 1.43 $'[11:-2] __version__='$Revision: 1.44 $'[11:-2]
import struct, time, os, bpthread, string, base64, sys import struct, time, os, bpthread, string, base64, sys
from struct import pack, unpack from struct import pack, unpack
...@@ -950,7 +950,7 @@ class FileStorage(BaseStorage.BaseStorage): ...@@ -950,7 +950,7 @@ class FileStorage(BaseStorage.BaseStorage):
def _redundant_pack(self, file, pos): def _redundant_pack(self, file, pos):
file.seek(pos-8) file.seek(pos-8)
p=u64(file.read(8)) p=u64(file.read(8))
file.seek(p+16) file.seek(pos-p+8)
return file.read(1) not in ' u' return file.read(1) not in ' u'
def pack(self, t, referencesf): def pack(self, t, referencesf):
...@@ -994,7 +994,8 @@ class FileStorage(BaseStorage.BaseStorage): ...@@ -994,7 +994,8 @@ class FileStorage(BaseStorage.BaseStorage):
if self._redundant_pack(file, packpos): if self._redundant_pack(file, packpos):
raise FileStorageError, ( raise FileStorageError, (
'The database has already been packed to a later time') 'The database has already been packed to a later time\n'
'or no changes have been made since the last pack')
rootl=[z64] rootl=[z64]
pop=rootl.pop pop=rootl.pop
......
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