[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
91/376: Remove obsolete SSH master connection code
From: |
Ludovic Courtès |
Subject: |
91/376: Remove obsolete SSH master connection code |
Date: |
Wed, 28 Jan 2015 22:04:15 +0000 |
civodul pushed a commit to tag 1.8
in repository guix.
commit 7b351da680cad41623c3f9853ff2eea3cb8e3545
Author: Eelco Dolstra <address@hidden>
Date: Thu Jul 24 16:19:17 2014 +0200
Remove obsolete SSH master connection code
---
perl/lib/Nix/SSH.pm | 55 +-------------------------------------------
scripts/build-remote.pl.in | 2 +-
2 files changed, 2 insertions(+), 55 deletions(-)
diff --git a/perl/lib/Nix/SSH.pm b/perl/lib/Nix/SSH.pm
index dd3e5ce..76a2099 100644
--- a/perl/lib/Nix/SSH.pm
+++ b/perl/lib/Nix/SSH.pm
@@ -6,63 +6,12 @@ use IPC::Open2;
our @ISA = qw(Exporter);
our @EXPORT = qw(
- sshOpts openSSHConnection closeSSHConnection
readN readInt readString readStrings
writeInt writeString writeStrings
connectToRemoteNix
);
-our @sshOpts = split ' ', ($ENV{"NIX_SSHOPTS"} or "");
-
-push @sshOpts, "-x";
-
-my $sshStarted = 0;
-my $sshHost;
-
-
-# Open a master SSH connection to `host', unless there already is a
-# running master connection (as determined by `-O check').
-sub openSSHConnection {
- my ($host) = @_;
- die if $sshStarted;
- $sshHost = $host;
- return 1 if system("ssh $sshHost @sshOpts -O check 2> /dev/null") == 0;
-
- my $tmpDir = tempdir("nix-ssh.XXXXXX", CLEANUP => 1, TMPDIR => 1)
- or die "cannot create a temporary directory";
-
- push @sshOpts, "-S", "$tmpDir/control";
-
- # Start the master. We can't use the `-f' flag (fork into
- # background after establishing the connection) because then the
- # child continues to run if we are killed. So instead make SSH
- # print "started" when it has established the connection, and wait
- # until we see that.
- open SSHPIPE, "ssh $sshHost @sshOpts -M -N -o LocalCommand='echo started'
-o PermitLocalCommand=yes |" or die;
-
- while (<SSHPIPE>) {
- chomp;
- if ($_ eq "started") {
- $sshStarted = 1;
- return 1;
- }
- }
-
- return 0;
-}
-
-
-# Tell the master SSH client to exit.
-sub closeSSHConnection {
- if ($sshStarted) {
- system("ssh $sshHost @sshOpts -O exit 2> /dev/null") == 0
- or warn "unable to stop SSH master: $?";
- $sshStarted = 0;
- }
-}
-
-
sub readN {
my ($bytes, $from) = @_;
my $res = "";
@@ -133,7 +82,7 @@ sub connectToRemoteNix {
# Start ‘nix-store --serve’ on the remote host.
my ($from, $to);
# FIXME: don't start a shell, start ssh directly.
- my $pid = open2($from, $to, "exec ssh $sshHost @{$sshOpts} nix-store
--serve --write $extraFlags");
+ my $pid = open2($from, $to, "exec ssh -x -a $sshHost @{$sshOpts} nix-store
--serve --write $extraFlags");
# Do the handshake.
my $SERVE_MAGIC_1 = 0x390c9deb; # FIXME
@@ -147,6 +96,4 @@ sub connectToRemoteNix {
}
-END { my $saved = $?; closeSSHConnection; $? = $saved; }
-
1;
diff --git a/scripts/build-remote.pl.in b/scripts/build-remote.pl.in
index a55d758..73d7abe 100755
--- a/scripts/build-remote.pl.in
+++ b/scripts/build-remote.pl.in
@@ -194,7 +194,7 @@ REQ: while (1) {
# Connect to the selected machine.
- @sshOpts = ("-i", $machine->{sshKeys}, "-x");
+ my @sshOpts = ("-i", $machine->{sshKeys});
$hostName = $machine->{hostName};
eval {
($from, $to) = connectToRemoteNix($hostName, address@hidden,
"2>&4");
- 79/376: Remove some obsolete files, (continued)
- 79/376: Remove some obsolete files, Ludovic Courtès, 2015/01/28
- 83/376: Fix bogus pass by reference, Ludovic Courtès, 2015/01/28
- 88/376: Refactor, Ludovic Courtès, 2015/01/28
- 87/376: tests/remote-builds.nix: Test failing build, Ludovic Courtès, 2015/01/28
- 89/376: build-remote.pl: Be less verbose on failing builds, Ludovic Courtès, 2015/01/28
- 86/376: nix-store --serve: Only monitor stdin during builds, Ludovic Courtès, 2015/01/28
- 77/376: nix-daemon: Less verbosity, Ludovic Courtès, 2015/01/28
- 74/376: nix-daemon: Use a thread instead of SIGPOLL to catch client disconnects, Ludovic Courtès, 2015/01/28
- 99/376: install-nix-from-closure.sh: Install cacert, Ludovic Courtès, 2015/01/28
- 93/376: nix-copy-closure: Implement --gzip via ssh's -C flag, Ludovic Courtès, 2015/01/28
- 91/376: Remove obsolete SSH master connection code,
Ludovic Courtès <=
- 100/376: Rename nixPath to __nixPath, Ludovic Courtès, 2015/01/28
- 95/376: Change the default for use-ssh-substituter to ‘true’, Ludovic Courtès, 2015/01/28
- 90/376: Implement nix-copy-closure --from via nix-store --serve, Ludovic Courtès, 2015/01/28
- 97/376: Remove outdated AUTHORS file, Ludovic Courtès, 2015/01/28
- 92/376: Fix NIX_SSHOPTS, Ludovic Courtès, 2015/01/28
- 103/376: Allow regular files as GC roots, Ludovic Courtès, 2015/01/28
- 94/376: nix-copy-closure: Drop --bzip2, --xz, --show-progress, Ludovic Courtès, 2015/01/28
- 84/376: Use pthread_cancel instead of a signal, Ludovic Courtès, 2015/01/28
- 102/376: Restore default SIGPIPE handler before invoking ‘man’, Ludovic Courtès, 2015/01/28
- 98/376: nix-profile.sh: Set $SSL_CERT_FILE, Ludovic Courtès, 2015/01/28