From 3e347220c82d1537723f49aa03a93a6f9d294417 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20M=C3=B6st?= Date: Fri, 14 Feb 2020 07:47:48 +0100 Subject: Fix PR_SET_PDEATHSIG results in Broken pipe (#2395) The ssh client is lazily started by the first worker thread, that requires a ssh connection. To avoid the ssh client to be killed, when the worker process is stopped, do not set PR_SET_PDEATHSIG. --- src/libstore/ssh.cc | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/libstore') diff --git a/src/libstore/ssh.cc b/src/libstore/ssh.cc index 2ee7115c5..84548a6e4 100644 --- a/src/libstore/ssh.cc +++ b/src/libstore/ssh.cc @@ -33,6 +33,9 @@ std::unique_ptr SSHMaster::startCommand(const std::string out.create(); auto conn = std::make_unique(); + ProcessOptions options; + options.dieWithParent = false; + conn->sshPid = startProcess([&]() { restoreSignals(); @@ -64,7 +67,7 @@ std::unique_ptr SSHMaster::startCommand(const std::string // could not exec ssh/bash throw SysError("unable to execute '%s'", args.front()); - }); + }, options); in.readSide = -1; @@ -91,6 +94,9 @@ Path SSHMaster::startMaster() Pipe out; out.create(); + ProcessOptions options; + options.dieWithParent = false; + state->sshMaster = startProcess([&]() { restoreSignals(); @@ -110,7 +116,7 @@ Path SSHMaster::startMaster() execvp(args.begin()->c_str(), stringsToCharPtrs(args).data()); throw SysError("unable to execute '%s'", args.front()); - }); + }, options); out.writeSide = -1; -- cgit v1.2.3 From 553e584f9231394212bb4d556c4a3eebc8444a63 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 17 Feb 2020 15:46:07 +0100 Subject: LocalStore::checkDerivationOutputs(): Improve error message --- src/libstore/local-store.cc | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) (limited to 'src/libstore') diff --git a/src/libstore/local-store.cc b/src/libstore/local-store.cc index b254d766a..e59624cd3 100644 --- a/src/libstore/local-store.cc +++ b/src/libstore/local-store.cc @@ -547,6 +547,18 @@ void LocalStore::checkDerivationOutputs(const StorePath & drvPath, const Derivat std::string drvName(drvPath.name()); drvName = string(drvName, 0, drvName.size() - drvExtension.size()); + auto check = [&](const StorePath & expected, const StorePath & actual, const std::string & varName) + { + if (actual != expected) + throw Error("derivation '%s' has incorrect output '%s', should be '%s'", + printStorePath(drvPath), printStorePath(actual), printStorePath(expected)); + auto j = drv.env.find(varName); + if (j == drv.env.end() || parseStorePath(j->second) != actual) + throw Error("derivation '%s' has incorrect environment variable '%s', should be '%s'", + printStorePath(drvPath), varName, printStorePath(actual)); + }; + + if (drv.isFixedOutput()) { DerivationOutputs::const_iterator out = drv.outputs.find("out"); if (out == drv.outputs.end()) @@ -554,24 +566,14 @@ void LocalStore::checkDerivationOutputs(const StorePath & drvPath, const Derivat bool recursive; Hash h; out->second.parseHashInfo(recursive, h); - auto outPath = makeFixedOutputPath(recursive, h, drvName); - StringPairs::const_iterator j = drv.env.find("out"); - if (out->second.path != outPath || j == drv.env.end() || parseStorePath(j->second) != outPath) - throw Error("derivation '%s' has incorrect output '%s', should be '%s'", - printStorePath(drvPath), printStorePath(out->second.path), printStorePath(outPath)); + check(makeFixedOutputPath(recursive, h, drvName), out->second.path, "out"); } else { Hash h = hashDerivationModulo(*this, drv, true); - - for (auto & i : drv.outputs) { - auto outPath = makeOutputPath(i.first, h, drvName); - StringPairs::const_iterator j = drv.env.find(i.first); - if (i.second.path != outPath || j == drv.env.end() || parseStorePath(j->second) != outPath) - throw Error("derivation '%s' has incorrect output '%s', should be '%s'", - printStorePath(drvPath), printStorePath(i.second.path), printStorePath(outPath)); - } + for (auto & i : drv.outputs) + check(makeOutputPath(i.first, h, drvName), i.second.path, i.first); } } -- cgit v1.2.3