hydra-eval-jobs: Don't go into an infinite recursion

The function getDerivation() can return false if its argument is a
derivation.  This happens if evaluating the name or system attribute
triggers an assertion.  In that case, we shouldn't recurse into the
attributes of the derivation.
This commit is contained in:
Eelco Dolstra 2012-10-04 14:31:47 -04:00
parent f4a24b94ee
commit a4ff9b0d08

View file

@ -16,7 +16,7 @@ using namespace nix;
void printHelp()
{
std::cout << "Syntax: eval-jobs <expr>\n";
std::cout << "Syntax: hydra-eval-jobs <expr>\n";
}
@ -110,6 +110,8 @@ static void findJobsWrapped(EvalState & state, XMLWriter & doc,
{
debug(format("at path `%1%'") % attrPath);
checkInterrupt();
state.forceValue(v);
if (v.type == tAttrs) {
@ -165,9 +167,11 @@ static void findJobsWrapped(EvalState & state, XMLWriter & doc,
}
else {
foreach (Bindings::iterator, i, *v.attrs)
findJobs(state, doc, argsUsed, argsLeft, *i->value,
(attrPath.empty() ? "" : attrPath + ".") + (string) i->name);
if (!state.isDerivation(v)) {
foreach (Bindings::iterator, i, *v.attrs)
findJobs(state, doc, argsUsed, argsLeft, *i->value,
(attrPath.empty() ? "" : attrPath + ".") + (string) i->name);
}
}
}
@ -261,4 +265,4 @@ void run(Strings args)
}
string programId = "eval-jobs";
string programId = "hydra-eval-jobs";