aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/libstore/build/derivation-goal.cc1
-rw-r--r--src/libstore/machines.cc2
-rw-r--r--src/libstore/ssh-store.cc8
-rw-r--r--src/libutil/thread-pool.cc17
-rw-r--r--tests/functional/dependencies.nix27
-rw-r--r--tests/functional/hash-check.nix21
-rw-r--r--tests/nixos/remote-builds-ssh-ng.nix3
7 files changed, 41 insertions, 38 deletions
diff --git a/src/libstore/build/derivation-goal.cc b/src/libstore/build/derivation-goal.cc
index 7f72efa6a..96140e10b 100644
--- a/src/libstore/build/derivation-goal.cc
+++ b/src/libstore/build/derivation-goal.cc
@@ -1211,6 +1211,7 @@ HookReply DerivationGoal::tryBuildHook()
else {
s += "\n";
writeLogsToStderr(s);
+ logger->log(lvlInfo, s);
}
}
diff --git a/src/libstore/machines.cc b/src/libstore/machines.cc
index d0897b81f..7314e3177 100644
--- a/src/libstore/machines.cc
+++ b/src/libstore/machines.cc
@@ -68,11 +68,11 @@ ref<Store> Machine::openStore() const
{
Store::Params storeParams;
if (storeUri.starts_with("ssh://")) {
+ storeParams["log-fd"] = "4";
storeParams["max-connections"] = "1";
}
if (storeUri.starts_with("ssh://") || storeUri.starts_with("ssh-ng://")) {
- storeParams["log-fd"] = "4";
if (sshKey != "")
storeParams["ssh-key"] = sshKey;
if (sshPublicHostKey != "")
diff --git a/src/libstore/ssh-store.cc b/src/libstore/ssh-store.cc
index fb60326c1..5c1fc0c1f 100644
--- a/src/libstore/ssh-store.cc
+++ b/src/libstore/ssh-store.cc
@@ -30,11 +30,6 @@ struct SSHStoreConfig : virtual RemoteStoreConfig, virtual CommonSSHStoreConfig
class SSHStore : public virtual SSHStoreConfig, public virtual RemoteStore
{
public:
- // Hack for getting remote build log output.
- // Intentionally not in `SSHStoreConfig` so that it doesn't appear in
- // the documentation
- const Setting<int> logFD{(StoreConfig*) this, -1, "log-fd", "file descriptor to which SSH's stderr is connected"};
-
SSHStore(const std::string & scheme, const std::string & host, const Params & params)
: StoreConfig(params)
, RemoteStoreConfig(params)
@@ -49,8 +44,7 @@ public:
sshPublicHostKey,
// Use SSH master only if using more than 1 connection.
connections->capacity() > 1,
- compress,
- logFD)
+ compress)
{
}
diff --git a/src/libutil/thread-pool.cc b/src/libutil/thread-pool.cc
index cd380b608..1c4488373 100644
--- a/src/libutil/thread-pool.cc
+++ b/src/libutil/thread-pool.cc
@@ -109,8 +109,21 @@ void ThreadPool::doWork(bool mainThread)
try {
std::rethrow_exception(exc);
} catch (std::exception & e) {
- if (!dynamic_cast<ThreadPoolShutDown*>(&e))
- ignoreExceptionExceptInterrupt();
+ if (!dynamic_cast<ThreadPoolShutDown*>(&e)) {
+ // Yes, this is not a destructor, but we cannot
+ // safely propagate an exception out of here.
+ //
+ // What happens is that if we do, shutdown()
+ // will have join() throw an exception if we
+ // are on a worker thread, preventing us from
+ // joining the rest of the threads. Although we
+ // could make the joining eat exceptions too,
+ // we could just as well not let Interrupted
+ // fall out to begin with, since the thread
+ // will immediately cleanly quit because of
+ // quit == true anyway.
+ ignoreExceptionInDestructor();
+ }
} catch (...) {
}
}
diff --git a/tests/functional/dependencies.nix b/tests/functional/dependencies.nix
index be1a7ae9a..0ede76b71 100644
--- a/tests/functional/dependencies.nix
+++ b/tests/functional/dependencies.nix
@@ -1,8 +1,7 @@
{ hashInvalidator ? "" }:
with import ./config.nix;
-let {
-
+let
input0 = mkDerivation {
name = "dependencies-input-0";
buildCommand = "mkdir $out; echo foo > $out/bar";
@@ -32,17 +31,15 @@ let {
outputHashAlgo = "sha256";
outputHash = "1dq9p0hnm1y75q2x40fws5887bq1r840hzdxak0a9djbwvx0b16d";
};
-
- body = mkDerivation {
- name = "dependencies-top";
- builder = ./dependencies.builder0.sh + "/FOOBAR/../.";
- input1 = input1 + "/.";
- input2 = "${input2}/.";
- input1_drv = input1;
- input2_drv = input2;
- input0_drv = input0;
- fod_input_drv = fod_input;
- meta.description = "Random test package";
- };
-
+in
+mkDerivation {
+ name = "dependencies-top";
+ builder = ./dependencies.builder0.sh + "/FOOBAR/../.";
+ input1 = input1 + "/.";
+ input2 = "${input2}/.";
+ input1_drv = input1;
+ input2_drv = input2;
+ input0_drv = input0;
+ fod_input_drv = fod_input;
+ meta.description = "Random test package";
}
diff --git a/tests/functional/hash-check.nix b/tests/functional/hash-check.nix
index f029f0cc9..6095bc57f 100644
--- a/tests/functional/hash-check.nix
+++ b/tests/functional/hash-check.nix
@@ -1,5 +1,4 @@
-let {
-
+let
input1 = derivation {
name = "dependencies-input-1";
system = "i086-msdos";
@@ -16,14 +15,12 @@ let {
outputHashAlgo = "md5";
outputHash = "ffffffffffffffffffffffffffffffff";
};
-
- body = derivation {
- name = "dependencies";
- system = "i086-msdos";
- builder = "/bar/sh";
- args = ["-e" "-x" (./dummy + "/FOOBAR/../.")];
- input1 = input1 + "/.";
- inherit input2;
- };
-
+in
+derivation {
+ name = "dependencies";
+ system = "i086-msdos";
+ builder = "/bar/sh";
+ args = ["-e" "-x" (./dummy + "/FOOBAR/../.")];
+ input1 = input1 + "/.";
+ inherit input2;
}
diff --git a/tests/nixos/remote-builds-ssh-ng.nix b/tests/nixos/remote-builds-ssh-ng.nix
index 8deb9a504..ec12f9066 100644
--- a/tests/nixos/remote-builds-ssh-ng.nix
+++ b/tests/nixos/remote-builds-ssh-ng.nix
@@ -97,7 +97,8 @@ in
builder.wait_for_unit("sshd.service")
out = client.fail("nix-build ${expr nodes.client 1} 2>&1")
- assert "error: failed to start SSH connection to 'root@builder': Host key verification failed" in out, f"No host verification error in {out}"
+ assert "Host key verification failed." in out, f"No host verification error:\n{out}"
+ assert "warning: SSH to 'root@builder' failed, stdout first line: '''" in out, f"No details about which host:\n{out}"
client.succeed(f"ssh -o StrictHostKeyChecking=no {builder.name} 'echo hello world' >&2")