+## 01_fix_restricted_test-server_option.dpatch by Carl Chenet +## +## All lines beginning with `## DP:' are a description of the patch. +## DP: Reimplemented from the Ubuntu patch by +## DP: Original patch from : https://bugs.launchpad.net/ubuntu/+source/rdiff-backup/+bug/349072 + address@hidden@ +diff -urNad rdiff-backup-1.2.8~/rdiff_backup/Main.py rdiff-backup-1.2.8/rdiff_backup/Main.py +--- rdiff-backup-1.2.8~/rdiff_backup/Main.py 2009-03-16 15:36:21.000000000 +0100 ++++ rdiff-backup-1.2.8/rdiff_backup/Main.py 2010-02-20 11:26:27.000000000 +0100 +@@ -288,7 +288,7 @@ + elif action == "remove-older-than": RemoveOlderThan(rps[0]) + elif action == "restore": Restore(*rps) + elif action == "restore-as-of": Restore(rps[0], rps[1], 1) +- elif action == "test-server": SetConnections.TestConnections() ++ elif action == "test-server": SetConnections.TestConnections(rps) + elif action == "verify": Verify(rps[0]) + else: raise AssertionError("Unknown action " + action) + +diff -urNad rdiff-backup-1.2.8~/rdiff_backup/SetConnections.py rdiff-backup-1.2.8/rdiff_backup/SetConnections.py +--- rdiff-backup-1.2.8~/rdiff_backup/SetConnections.py 2009-03-16 15:36:21.000000000 +0100 ++++ rdiff-backup-1.2.8/rdiff_backup/SetConnections.py 2010-02-20 11:29:43.000000000 +0100 +@@ -241,20 +241,25 @@ + Globals.backup_reader = Globals.isbackup_reader = \ + Globals.backup_writer = Globals.isbackup_writer = None + +-def TestConnections(): ++def TestConnections(rpaths): + """Test connections, printing results""" + if len(Globals.connections) == 1: print "No remote connections specified" + else: +- for i in range(1, len(Globals.connections)): test_connection(i) ++ assert len(Globals.connections) == len(rpaths) + 1 ++ for i in range(1, len(Globals.connections)): ++ test_connection(i, rpaths[i-1]) + +-def test_connection(conn_number): ++def test_connection(conn_number, rp): + """Test connection. conn_number 0 is the local connection""" + print "Testing server started by: ", __conn_remote_cmds[conn_number] + conn = Globals.connections[conn_number] + try: + assert conn.Globals.get('current_time') is None +- assert type(conn.os.listdir('.')) is list + version = conn.Globals.get('version') ++ try: ++ assert type(conn.os.getuid()) is int ++ except AttributeError: # Windows doesn't support os.getuid() ++ assert type(conn.os.listdir(rp.path)) is list + except: + sys.stderr.write("Server tests failed\n") + raise