Commit 86da0e32 authored by owsla's avatar owsla

Print more helpful error messages when the remote command cannot be started

on Windows. Fix --test-server option when used with remote Windows clients.


git-svn-id: http://svn.savannah.nongnu.org/svn/rdiff-backup@1011 2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109
parent b9d079db
New in v1.2.6 (????/??/??)
---------------------------
Print more helpful error messages when the remote command cannot be started
on Windows. Thanks to Dominic for the bug report. (Andrew Ferguson)
Fix --test-server option when used with remote Windows clients. Thanks to
Thanos Diacakis for testing. (Andrew Ferguson)
Fix --override-chars-to-quote option. (Andrew Ferguson)
......
......@@ -119,7 +119,10 @@ def parse_file_desc(file_desc):
def fill_schema(host_info):
"""Fills host_info into the schema and returns remote command"""
try:
return __cmd_schema % host_info
except TypeError:
Log.FatalError("Invalid remote schema:\n\n%s\n" % __cmd_schema)
def init_connection(remote_cmd):
"""Run remote_cmd, register connection, and then return it
......@@ -134,10 +137,13 @@ def init_connection(remote_cmd):
Log("Executing " + remote_cmd, 4)
if os.name == "nt":
import subprocess
try:
process = subprocess.Popen(remote_cmd, shell=False, bufsize=0,
stdin=subprocess.PIPE,
stdout=subprocess.PIPE)
(stdin, stdout) = (process.stdin, process.stdout)
except OSError:
(stdin, stdout) = (None, None)
else:
stdin, stdout = os.popen2(remote_cmd)
conn_number = len(Globals.connections)
......@@ -152,7 +158,7 @@ def init_connection(remote_cmd):
def check_connection_version(conn, remote_cmd):
"""Log warning if connection has different version"""
try: remote_version = conn.Globals.get('version')
except connection.ConnectionReadError, exception:
except connection.ConnectionError, exception:
Log.FatalError("""%s
Couldn't start up the remote connection by executing
......@@ -247,9 +253,7 @@ def test_connection(conn_number):
conn = Globals.connections[conn_number]
try:
assert conn.Globals.get('current_time') is None
assert type(conn.os.name) is str
if (conn.os.name != 'nt'):
assert type(conn.os.getuid()) is int
assert type(conn.os.listdir('.')) is list
version = conn.Globals.get('version')
except:
sys.stderr.write("Server tests failed\n")
......
......@@ -203,7 +203,7 @@ class LowLevelPipeConnection(Connection):
C.long2str(long(len(data))))
self.outpipe.write(data)
self.outpipe.flush()
except IOError: raise ConnectionWriteError()
except (IOError, AttributeError): raise ConnectionWriteError()
def _read(self, length):
"""Read length bytes from inpipe, returning result"""
......
New in v1.3.1 (????/??/??)
---------------------------
Print more helpful error messages when the remote command cannot be started
on Windows. Thanks to Dominic for the bug report. (Andrew Ferguson)
Fix --test-server option when used with remote Windows clients. Thanks to
Thanos Diacakis for testing. (Andrew Ferguson)
Fix --override-chars-to-quote option. (Andrew Ferguson)
Fix typo in robust.py which broke error reporting. Closes Savannah bug #25255.
......
......@@ -119,7 +119,10 @@ def parse_file_desc(file_desc):
def fill_schema(host_info):
"""Fills host_info into the schema and returns remote command"""
try:
return __cmd_schema % host_info
except TypeError:
Log.FatalError("Invalid remote schema:\n\n%s\n" % __cmd_schema)
def init_connection(remote_cmd):
"""Run remote_cmd, register connection, and then return it
......@@ -134,10 +137,13 @@ def init_connection(remote_cmd):
Log("Executing " + remote_cmd, 4)
if os.name == "nt":
import subprocess
try:
process = subprocess.Popen(remote_cmd, shell=False, bufsize=0,
stdin=subprocess.PIPE,
stdout=subprocess.PIPE)
(stdin, stdout) = (process.stdin, process.stdout)
except OSError:
(stdin, stdout) = (None, None)
else:
stdin, stdout = os.popen2(remote_cmd)
conn_number = len(Globals.connections)
......@@ -152,7 +158,7 @@ def init_connection(remote_cmd):
def check_connection_version(conn, remote_cmd):
"""Log warning if connection has different version"""
try: remote_version = conn.Globals.get('version')
except connection.ConnectionReadError, exception:
except connection.ConnectionError, exception:
Log.FatalError("""%s
Couldn't start up the remote connection by executing
......@@ -247,7 +253,7 @@ def test_connection(conn_number):
conn = Globals.connections[conn_number]
try:
assert conn.Globals.get('current_time') is None
assert type(conn.os.getuid()) is int
assert type(conn.os.listdir('.')) is list
version = conn.Globals.get('version')
except:
sys.stderr.write("Server tests failed\n")
......
......@@ -203,7 +203,7 @@ class LowLevelPipeConnection(Connection):
C.long2str(long(len(data))))
self.outpipe.write(data)
self.outpipe.flush()
except IOError: raise ConnectionWriteError()
except (IOError, AttributeError): raise ConnectionWriteError()
def _read(self, length):
"""Read length bytes from inpipe, returning result"""
......
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