Subject: bug#74832: guix copy incorrectly assumes port is 22

From: Dariqq <[email-masked]>
Date: Thu, 12 Dec 2024 16:45:20 +0000

Hello,

Here is bug report number 3 with [email-masked].

When using a host defined in ~/.ssh/config in the --to/--from argument 
in guix-copy "send-to-remote-host" and "retrieve-from-remote-host" 
incorrectly pass the port as 22 to open-ssh-session.

This then leads to a failure when trying to connect:
--8<---------------cut here---------------start------------->8---

guix copy hello --to=name
guix copy: error: failed to authenticate server at 'domain': not-known

--8<---------------cut here---------------end--------------->8---

With [email-masked] guile-ssh silently ignored the "wrong port" and 
instead connects to the one specified by the ssh Host

--8<---------------cut here---------------start------------->8---
guix copy hello --to=name

with [email-masked] :
#<session dariqq@domain:10022 (disconnected) 7f21d88a2fe0>

[email-masked]:
#<session dariqq@localhost:22 (disconnected) 7f17887a2fe0>
--8<---------------cut here---------------end--------------->8---

Are the (or port 22) clauses in guix/scripts/copy.scm still neccesary?

 From my limited testing removing them fixed the problem and passing a 
port of #f will result in 22 being used.

This might also be a problem in other places wghere open-ssh-session is 
used?