lib.ec.ssh.Paramiko: Fix URI parameters, stdin handling, and output deadlock #85

Merged
Jan Lindemann merged 3 commits from jan/fix/20260905-lib-ec-ssh-paramiko-fix-uri-parameters-stdin-handling-and-output-deadlock into master 2026-09-05 19:09:29 +02:00 AGit
Showing only changes of commit e6295f7d2b - Show all commits

lib.ec.ssh.Paramiko: Avoid recv deadlock
All checks were successful
CI / Packaging - Kali Linux (pull_request) Successful in 4m13s
CI / Packaging - OpenSUSE Tumbleweed (pull_request) Successful in 4m13s
CI / Packaging test (pull_request) Successful in 0s
CI / Packaging - Kali Linux (push) Successful in 3m56s
CI / Packaging - OpenSUSE Tumbleweed (push) Successful in 4m1s
CI / Packaging test (push) Successful in 0s

_run_ssh() waits for the remote process's exit status before reading
stdout and stderr. When a command produces more output than the
channel's flow-control window can hold, the server stops sending, the
remote process blocks on its write and never exits, and
recv_exit_status() blocks forever.

Drain stdout and stderr to EOF first - the channels close when the
process exits, so reading them also implies completion - and only
then query the exit status.

Assisted-by: unsloth/Qwen3.8-27B-GGUF:Q4_K_M with pi.dev v0.84.2
Signed-off-by: Jan Lindemann <jan@janware.com>
Jan Lindemann 2026-08-16 07:02:54 +02:00
Signed by: Jan Lindemann
GPG key ID: 3750640C9E25DD61

View file

@ -95,5 +95,7 @@ class Paramiko(Base):
if cmd_input is not None:
stdin.write(cmd_input)
stdin.channel.shutdown_write()
stdout_data = stdout.read()
stderr_data = stderr.read()
exit_status = stdout.channel.recv_exit_status()
return Result(stdout.read(), stderr.read(), exit_status, cmd = cmd)
return Result(stdout_data, stderr_data, exit_status, cmd = cmd)