unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
* bug#33266: guix-copy: Honor the SSH port of a host when defined in ~/.ssh/config
@ 2018-11-05  4:58 Maxim Cournoyer
  2018-11-06 14:12 ` Ludovic Courtès
  0 siblings, 1 reply; 4+ messages in thread
From: Maxim Cournoyer @ 2018-11-05  4:58 UTC (permalink / raw)
  To: 33266

[-- Attachment #1: Type: text/plain, Size: 590 bytes --]

Hello,

I recently stumbled on the bug where guix copy would the port 22 even
when I had specified a different one in my ~/.ssh/config file.

This bug is triggered when omitting the port in the --to= (or --from)
expression, such as in

guix copy --to=somehost bash

And where somehost exists in ~/.ssh/config, say:

Host somehost
     User someuser
     HostName someplace.somedns.net
     Port 1234

Instead of using port 1234, the port 22 would be used.  Commit
cc1dfc202f is the reason of this overriding; the attached patch 
reverts it, with a detailed explanation.

Thank you,

Maxim


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Revert-copy-Default-to-port-22.patch --]
[-- Type: text/x-patch, Size: 1935 bytes --]

From 942eb8cabef5b7c8b4425c765b6ee2ac9f529ad8 Mon Sep 17 00:00:00 2001
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Date: Sun, 4 Nov 2018 23:35:16 -0500
Subject: [PATCH] Revert "copy: Default to port 22."

This reverts commit cc1dfc202f2fefb6c2eb9467d1fc90a9154550c9.  Specifying a
default port had the undesirable effect of disregarding a port specification
for a given host in the ~/.ssh/config that would otherwise have been honored
at the time `open-ssh-session' calls the `session-parse-config!' method.

In any case, `make-session' will default the port value of the created session
to 22 if left unspecified.
---
 guix/scripts/copy.scm | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/guix/scripts/copy.scm b/guix/scripts/copy.scm
index 4c8592985..d35eed74e 100644
--- a/guix/scripts/copy.scm
+++ b/guix/scripts/copy.scm
@@ -75,8 +75,7 @@ package names, build the underlying packages before sending them."
 
       (and (or (assoc-ref opts 'dry-run?)
                (build-derivations local drv))
-           (let* ((session (open-ssh-session host #:user user
-                                             #:port (or port 22)))
+           (let* ((session (open-ssh-session host #:user user #:port port))
                   (sent    (send-files local items
                                        (connect-to-remote-daemon session)
                                        #:recursive? #t)))
@@ -89,7 +88,7 @@ package names, build the underlying packages before sending them."
     (let*-values (((user host port)
                    (ssh-spec->user+host+port source))
                   ((session)
-                   (open-ssh-session host #:user user #:port (or port 22)))
+                   (open-ssh-session host #:user user #:port port))
                   ((remote)
                    (connect-to-remote-daemon session)))
       (set-build-options-from-command-line local opts)
-- 
2.19.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-01-22 22:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-11-05  4:58 bug#33266: guix-copy: Honor the SSH port of a host when defined in ~/.ssh/config Maxim Cournoyer
2018-11-06 14:12 ` Ludovic Courtès
2018-11-09  3:35   ` Maxim Cournoyer
2019-01-22 22:09     ` Ludovic Courtès

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).