mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-26 15:56:18 +02:00
Handle debug messages from runChild()
Turns out that "nix-build -vvv" with chroots enabled has been broken for some time, because some debug message got interpreted as an error.
This commit is contained in:
parent
3db950aab7
commit
30d19a2bdc
1 changed files with 16 additions and 10 deletions
|
@ -1,3 +1,4 @@
|
||||||
|
#include <iostream>
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include "references.hh"
|
#include "references.hh"
|
||||||
|
@ -2161,8 +2162,14 @@ void DerivationGoal::startBuilder()
|
||||||
singleton<set<int> >(builderOut.readSide), true, true);
|
singleton<set<int> >(builderOut.readSide), true, true);
|
||||||
|
|
||||||
/* Check if setting up the build environment failed. */
|
/* Check if setting up the build environment failed. */
|
||||||
string msg = readLine(builderOut.readSide);
|
while (true) {
|
||||||
if (!msg.empty()) throw Error(msg);
|
string msg = readLine(builderOut.readSide);
|
||||||
|
if (string(msg, 0, 1) == "\1") {
|
||||||
|
if (msg.size() == 1) break;
|
||||||
|
throw Error(string(msg, 1));
|
||||||
|
}
|
||||||
|
printMsg(lvlDebug, msg);
|
||||||
|
}
|
||||||
|
|
||||||
if (settings.printBuildTrace) {
|
if (settings.printBuildTrace) {
|
||||||
printMsg(lvlError, format("@ build-started %1% - %2% %3%")
|
printMsg(lvlError, format("@ build-started %1% - %2% %3%")
|
||||||
|
@ -2178,6 +2185,8 @@ void DerivationGoal::runChild()
|
||||||
|
|
||||||
try { /* child */
|
try { /* child */
|
||||||
|
|
||||||
|
logType = ltFlat;
|
||||||
|
|
||||||
commonChildInit(builderOut);
|
commonChildInit(builderOut);
|
||||||
|
|
||||||
#if CHROOT_ENABLED
|
#if CHROOT_ENABLED
|
||||||
|
@ -2502,6 +2511,9 @@ void DerivationGoal::runChild()
|
||||||
}
|
}
|
||||||
sandboxProfile += ")\n";
|
sandboxProfile += ")\n";
|
||||||
|
|
||||||
|
debug("Generated sandbox profile:");
|
||||||
|
debug(sandboxProfile);
|
||||||
|
|
||||||
builder = "/usr/bin/sandbox-exec";
|
builder = "/usr/bin/sandbox-exec";
|
||||||
args.push_back("sandbox-exec");
|
args.push_back("sandbox-exec");
|
||||||
args.push_back("-p");
|
args.push_back("-p");
|
||||||
|
@ -2519,13 +2531,7 @@ void DerivationGoal::runChild()
|
||||||
restoreSIGPIPE();
|
restoreSIGPIPE();
|
||||||
|
|
||||||
/* Indicate that we managed to set up the build environment. */
|
/* Indicate that we managed to set up the build environment. */
|
||||||
writeFull(STDERR_FILENO, "\n");
|
writeFull(STDERR_FILENO, string("\1\n"));
|
||||||
|
|
||||||
/* This needs to be after that fateful '\n', and I didn't want to duplicate code */
|
|
||||||
if (useChroot && SANDBOX_ENABLED) {
|
|
||||||
printMsg(lvlDebug, "Generated sandbox profile:");
|
|
||||||
printMsg(lvlDebug, sandboxProfile);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Execute the program. This should not return. */
|
/* Execute the program. This should not return. */
|
||||||
if (isBuiltin(*drv)) {
|
if (isBuiltin(*drv)) {
|
||||||
|
@ -2547,7 +2553,7 @@ void DerivationGoal::runChild()
|
||||||
throw SysError(format("executing ‘%1%’") % drv->builder);
|
throw SysError(format("executing ‘%1%’") % drv->builder);
|
||||||
|
|
||||||
} catch (std::exception & e) {
|
} catch (std::exception & e) {
|
||||||
writeFull(STDERR_FILENO, "while setting up the build environment: " + string(e.what()) + "\n");
|
writeFull(STDERR_FILENO, "\1while setting up the build environment: " + string(e.what()) + "\n");
|
||||||
_exit(1);
|
_exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue