Skip to content

Commit 7ec1427

Browse files
committed
libstore: fixup fakeSSH check
This broke invocations like: NIX_SSHOPTS='-p2222 -oUserKnownHostsFile=/dev/null -oStrictHostKeyChecking=no' nix copy /nix/store/......-foo --to ssh-ng://root@localhost In Nix 2.30.2, fakeSSH was enabled when the "thing I want to connect to" was plain old "localhost". Previously, this check was written as: , fakeSSH(host == "localhost") Given the above invocation, `host` would have been `root@localhost`, and thus `fakeSSH` would be `false` because `root@localhost` != `localhost`. However, since 49ba061, `authority.host` returned _just_ the host (`localhost`, no user) and erroneously enabled `fakeSSH` in this case, causing `NIX_SSHOPTS` to be ignored (since, when `fakeSSH` is `true`, `SSHMaster::startCommand` doesn't call `addCommonSSHOpts`). `authority.to_string()` accurately returns the expected `root@localhost` format (given the above invocation), fixing this.
1 parent d5d7ca0 commit 7ec1427

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/libstore/ssh.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ SSHMaster::SSHMaster(
7878
oss << authority.host;
7979
return std::move(oss).str();
8080
}())
81-
, fakeSSH(authority.host == "localhost")
81+
, fakeSSH(authority.to_string() == "localhost")
8282
, keyFile(keyFile)
8383
, sshPublicHostKey(parsePublicHostKey(authority.host, sshPublicHostKey))
8484
, useMaster(useMaster && !fakeSSH)

0 commit comments

Comments
 (0)