Commit 3ef1d0df authored by owsla's avatar owsla

Squash regress/check_pids bug and properly pickle RPath's


git-svn-id: http://svn.savannah.nongnu.org/svn/rdiff-backup@815 2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109
parent 53accf1b
New in v1.1.12 (????/??/??)
---------------------------
Squash bug where --check-destination-dir or regress operation failed
after crash when --force option was not used. RPath's are now
properly pickled. (Andrew Ferguson)
Workaround for tempfile.TemporaryFile() having different behavior
on Windows/Cygwin. (Andrew Ferguson)
......
......@@ -172,6 +172,7 @@ def set_allowed_requests(sec_level):
"backup.DestinationStruct.patch_and_increment",
"Main.backup_touch_curmirror_local",
"Main.backup_remove_curmirror_local",
"regress.check_pids",
"Globals.ITRB.increment_stat",
"statistics.record_error",
"log.ErrorLog.write_if_open",
......
......@@ -20,7 +20,7 @@
"""Support code for remote execution and data transfer"""
from __future__ import generators
import types, os, tempfile, cPickle, shutil, traceback, pickle, \
import types, os, tempfile, cPickle, shutil, traceback, \
socket, sys, gzip
# The following EA and ACL modules may be used if available
try: import xattr
......@@ -140,8 +140,7 @@ class LowLevelPipeConnection(Connection):
def _putobj(self, obj, req_num):
"""Send a generic python obj down the outpipe"""
# for some reason there is an error when cPickle is used below..
self._write("o", pickle.dumps(obj, 1), req_num)
self._write("o", cPickle.dumps(obj, 1), req_num)
def _putbuf(self, buf, req_num):
"""Send buffer buf down the outpipe"""
......
......@@ -753,17 +753,17 @@ class RPath(RORPath):
def __getstate__(self):
"""Return picklable state
The connection must be local because we can't pickle a
connection. Data and any attached file also won't be saved.
The rpath's connection will be encoded as its conn_number. It
and the other information is put in a tuple. Data and any attached
file won't be saved.
"""
assert self.conn is Globals.local_connection
return (self.index, self.base, self.data)
return (self.conn.conn_number, self.base, self.index, self.data)
def __setstate__(self, rpath_state):
"""Reproduce RPath from __getstate__ output"""
self.conn = Globals.local_connection
self.index, self.base, self.data = rpath_state
conn_number, self.base, self.index, self.data = rpath_state
self.conn = Globals.connection_dict[conn_number]
self.path = "/".join((self.base,) + self.index)
def setdata(self):
......
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