summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbescoto <bescoto@2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109>2003-11-01 23:16:11 +0000
committerbescoto <bescoto@2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109>2003-11-01 23:16:11 +0000
commit365194867575d4b7d429bb899b0340bd755d2761 (patch)
tree8f71d06d20e46b17989a725f5874864b95878e88
parent7f11187b75621b02d614aa5bb3d1ec373eab4dd7 (diff)
downloadrdiff-backup-365194867575d4b7d429bb899b0340bd755d2761.tar.gz
Fix for --windows-mode and similar
git-svn-id: http://svn.savannah.nongnu.org/svn/rdiff-backup/branches/r0-12@485 2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109
-rw-r--r--rdiff-backup/CHANGELOG5
-rw-r--r--rdiff-backup/rdiff_backup/connection.py16
-rw-r--r--rdiff-backup/testing/connectiontest.py11
3 files changed, 31 insertions, 1 deletions
diff --git a/rdiff-backup/CHANGELOG b/rdiff-backup/CHANGELOG
index 2900fd9..ae21931 100644
--- a/rdiff-backup/CHANGELOG
+++ b/rdiff-backup/CHANGELOG
@@ -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)
---------------------------
diff --git a/rdiff-backup/rdiff_backup/connection.py b/rdiff-backup/rdiff_backup/connection.py
index 05aef20..8250724 100644
--- a/rdiff-backup/rdiff_backup/connection.py
+++ b/rdiff-backup/rdiff_backup/connection.py
@@ -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()
diff --git a/rdiff-backup/testing/connectiontest.py b/rdiff-backup/testing/connectiontest.py
index 265862a..9b1d202 100644
--- a/rdiff-backup/testing/connectiontest.py
+++ b/rdiff-backup/testing/connectiontest.py
@@ -1,7 +1,7 @@
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,