Re: Using SSH : sys.stdin.read(n) non-blocking issue?
Hi, On 15 October 2021 00:02:04 UTC, Simon Defayette wrote: >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? No, and I have doubts, all cases of connection issues of this kind so far have been brought down to a system setup issue. I mean, does the command `ssh -C my_user@[my_server_ip] rdiff-backup --server` if called from the command line? Do you have rdiff- backup 32 or 64 bits? Did you check the Windows FAQ? KR, Eric > >Thanks, >Simon Defayette
Using SSH : sys.stdin.read(n) non-blocking issue?
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