[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
284/376: SSH.pm: Print a friendlier message if connecting fails
From: |
Ludovic Courtès |
Subject: |
284/376: SSH.pm: Print a friendlier message if connecting fails |
Date: |
Wed, 28 Jan 2015 22:05:39 +0000 |
civodul pushed a commit to tag 1.8
in repository guix.
commit d436e44ae3a7fc310660db0cc3078a9c1c9318e4
Author: Eelco Dolstra <address@hidden>
Date: Mon Nov 10 16:03:51 2014 +0100
SSH.pm: Print a friendlier message if connecting fails
"got EOF while expecting 8 bytes from remote side" is not very
helpful.
---
perl/lib/Nix/CopyClosure.pm | 1 +
perl/lib/Nix/SSH.pm | 15 +++++++++++----
2 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/perl/lib/Nix/CopyClosure.pm b/perl/lib/Nix/CopyClosure.pm
index 1520f10..800feb3 100644
--- a/perl/lib/Nix/CopyClosure.pm
+++ b/perl/lib/Nix/CopyClosure.pm
@@ -57,6 +57,7 @@ sub copyTo {
if ($@) {
chomp $@;
warn "$@; falling back to old closure copying method\n";
+ $@ = "";
return oldCopyTo(@_);
}
diff --git a/perl/lib/Nix/SSH.pm b/perl/lib/Nix/SSH.pm
index 9e0c10b..95393d8 100644
--- a/perl/lib/Nix/SSH.pm
+++ b/perl/lib/Nix/SSH.pm
@@ -1,5 +1,6 @@
package Nix::SSH;
+use utf8;
use strict;
use File::Temp qw(tempdir);
use IPC::Open2;
@@ -89,10 +90,16 @@ sub connectToRemoteNix {
my $pid = open2($from, $to, "exec ssh -x -a $sshHost @globalSshOpts
@{$sshOpts} nix-store --serve --write $extraFlags");
# Do the handshake.
- my $SERVE_MAGIC_1 = 0x390c9deb; # FIXME
- my $clientVersion = 0x200;
- syswrite($to, pack("L<x4L<x4", $SERVE_MAGIC_1, $clientVersion)) or die;
- die "did not get valid handshake from remote host\n" if readInt($from) !=
0x5452eecb;
+ my $magic;
+ eval {
+ my $SERVE_MAGIC_1 = 0x390c9deb; # FIXME
+ my $clientVersion = 0x200;
+ syswrite($to, pack("L<x4L<x4", $SERVE_MAGIC_1, $clientVersion)) or die;
+ $magic = readInt($from);
+ };
+ die "unable to connect to ‘$sshHost’\n" if $@;
+ die "did not get valid handshake from remote host\n" if $magic !=
0x5452eecb;
+
my $serverVersion = readInt($from);
die "unsupported server version\n" if $serverVersion < 0x200 ||
$serverVersion >= 0x300;
- 274/376: Don't pull in git when doing a nix-shell, (continued)
- 274/376: Don't pull in git when doing a nix-shell, Ludovic Courtès, 2015/01/28
- 247/376: mkList: Scrub better, Ludovic Courtès, 2015/01/28
- 248/376: Improved error message when encountering unsupported file types, Ludovic Courtès, 2015/01/28
- 295/376: nix-daemon: Call exit(), not _exit(), Ludovic Courtès, 2015/01/28
- 242/376: Add primop ‘attrValues’, Ludovic Courtès, 2015/01/28
- 254/376: nix-store -q: Check for conflicting flags, Ludovic Courtès, 2015/01/28
- 265/376: Merge pull request #380 from shlevy/temp-disable-darwin, Ludovic Courtès, 2015/01/28
- 253/376: nix-channel: Add --rollback flag, Ludovic Courtès, 2015/01/28
- 289/376: Document functors, Ludovic Courtès, 2015/01/28
- 259/376: Export realiseContext in libnixexpr, Ludovic Courtès, 2015/01/28
- 284/376: SSH.pm: Print a friendlier message if connecting fails,
Ludovic Courtès <=
- 278/376: Typo, Ludovic Courtès, 2015/01/28
- 292/376: Add a test for the binary tarball installer, Ludovic Courtès, 2015/01/28
- 296/376: Disable vacuuming the DB after garbage collection, Ludovic Courtès, 2015/01/28
- 298/376: Fix bad operator, Ludovic Courtès, 2015/01/28
- 270/376: Revert "Temporarily disable darwin builds while hydra's darwin is borked", Ludovic Courtès, 2015/01/28
- 283/376: Doh, Ludovic Courtès, 2015/01/28
- 300/376: import derivation: cleanup, Ludovic Courtès, 2015/01/28
- 264/376: Temporarily disable darwin builds while hydra's darwin is borked, Ludovic Courtès, 2015/01/28
- 291/376: Fix message, Ludovic Courtès, 2015/01/28
- 273/376: Fix more warnings, Ludovic Courtès, 2015/01/28