Commit ecdab7e2 authored by bescoto's avatar bescoto

Fix for --windows-mode and similar


git-svn-id: http://svn.savannah.nongnu.org/svn/rdiff-backup@485 2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109
parent 7a32a30d
......@@ -15,6 +15,11 @@ When regressing, remove mirror_metadata and similar increments first.
This will hopefully help regressing a backup that failed because disk
was full (reported by Erik Forsberg).
Fixed rather important quoting problem: quoting directives like
--windows-mode were simply ignored when rdiff-backup was running
remotely! I'm surprised no one noticed this. Are none of you using
--windows-mode or similar?
New in v0.12.5 (2003/09/27)
---------------------------
......
......@@ -98,6 +98,7 @@ class LowLevelPipeConnection(Connection):
b - string
q - quit signal
R - RPath
Q - QuotedRPath
r - RORPath only
c - PipeConnection object
......@@ -122,6 +123,8 @@ class LowLevelPipeConnection(Connection):
log.Log.conn("sending", obj, req_num)
if type(obj) is types.StringType: self._putbuf(obj, req_num)
elif isinstance(obj, connection.Connection):self._putconn(obj, req_num)
elif isinstance(obj, FilenameMapping.QuotedRPath):
self._putqrpath(obj, req_num)
elif isinstance(obj, rpath.RPath): self._putrpath(obj, req_num)
elif isinstance(obj, rpath.RORPath): self._putrorpath(obj, req_num)
elif ((hasattr(obj, "read") or hasattr(obj, "write"))
......@@ -159,6 +162,12 @@ class LowLevelPipeConnection(Connection):
rpath.index, rpath.data)
self._write("R", cPickle.dumps(rpath_repr, 1), req_num)
def _putqrpath(self, qrpath, req_num):
"""Put a quoted rpath into the pipe (similar to _putrpath above)"""
qrpath_repr = (qrpath.conn.conn_number, qrpath.base,
qrpath.index, qrpath.data)
self._write("Q", cPickle.dumps(qrpath_repr, 1), req_num)
def _putrorpath(self, rorpath, req_num):
"""Put an rorpath into the pipe
......@@ -230,6 +239,7 @@ class LowLevelPipeConnection(Connection):
result = iterfile.FileToRORPIter(VirtualFile(self, int(data)))
elif format_string == "r": result = self._getrorpath(data)
elif format_string == "R": result = self._getrpath(data)
elif format_string == "Q": result = self._getqrpath(data)
else:
assert format_string == "c", header_string
result = Globals.connection_dict[int(data)]
......@@ -247,6 +257,12 @@ class LowLevelPipeConnection(Connection):
return rpath.RPath(Globals.connection_dict[conn_number],
base, index, data)
def _getqrpath(self, raw_qrpath_buf):
"""Return QuotedRPath object from raw buffer"""
conn_number, base, index, data = cPickle.loads(raw_qrpath_buf)
return FilenameMapping.QuotedRPath(
Globals.connection_dict[conn_number], base, index, data)
def _close(self):
"""Close the pipes associated with the connection"""
self.outpipe.close()
......
import unittest, types, tempfile, os, sys
from commontest import *
from rdiff_backup.connection import *
from rdiff_backup import Globals, rpath
from rdiff_backup import Globals, rpath, FilenameMapping
class LocalConnectionTest(unittest.TestCase):
"""Test the dummy connection"""
......@@ -144,6 +144,15 @@ class PipeConnectionTest(unittest.TestCase):
assert self.conn.reval("lambda rp: rp.data", rp) == rp.data
assert self.conn.reval("lambda rp: rp.conn is Globals.local_connection", rp)
def testQuotedRPaths(self):
"""Test transmission of quoted rpaths"""
qrp = FilenameMapping.QuotedRPath(self.conn,
"testfiles/various_file_types/regular_file")
assert self.conn.reval("lambda qrp: qrp.data", qrp) == qrp.data
assert qrp.isreg(), qrp
qrp_class_str = self.conn.reval("lambda qrp: str(qrp.__class__)", qrp)
assert qrp_class_str.find("QuotedRPath") > -1, qrp_class_str
def testExceptions(self):
"""Test exceptional results"""
self.assertRaises(os.error, self.conn.os.lstat,
......
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