Using SSH : sys.stdin.read(n) non-blocking issue?
Simon Defayette <[email protected]>
| Newsgroups | gmane.comp.sysutils.backup.rdiff-backup.general |
|---|---|
| Message-ID | <CACQdU74tW4Fv__oVkRjZ9OTL+saG1_i7gQ7e6gJEMC5u_3KEtg@mail.gmail.com> |
Hi,
I have a windows 2019 server where I want to backup files over a SSH link
to a Linux Ubuntu server and I get an error in Windows:
Couldn't start up the remote connection by executing
C:\Windows\system32\OpenSSH\ssh.exe -C my_user@[my_server_ip] rdiff-backup
--server
When I use -v9 option it says 'Fatal Error: Truncated header string
(problem probably originated remotely)'
I then downloaded python on the windows 2019 server and run commands that I
saw from Eric Zolf seen here:
https://github.com/rdiff-backup/rdiff-backup/issues/393
>>> import subprocess
>>> process = subprocess.Popen("ssh -C my_user@[my_server_ip] rdiff-backup
--server", shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE)
>>> process.communicate()
and after some testing and some tweaks I may have seen that
self.inpipe.read in _get(self) located in connection.py is non-blocking. I
think this is an issue since it will raise an exception right away if there
are no bytes available.
def _get(self):
"""Read an object from the pipe and return (req_num, value)"""
header_string = self.inpipe.read(9)
if not len(header_string) == 9:
raise ConnectionReadError("Truncated header string (problem "
"probably originated remotely)")
Can someone confirm this?
Thanks,
Simon Defayette