forked from lix-project/lix
elide the 'ErrorInfo' in logError and logWarning calls
This commit is contained in:
parent
734283d636
commit
d82d230b40
|
@ -200,8 +200,7 @@ static int _main(int argc, char * * argv)
|
||||||
|
|
||||||
} catch (std::exception & e) {
|
} catch (std::exception & e) {
|
||||||
auto msg = chomp(drainFD(5, false));
|
auto msg = chomp(drainFD(5, false));
|
||||||
logError(
|
logError({
|
||||||
ErrorInfo {
|
|
||||||
.name = "Remote build",
|
.name = "Remote build",
|
||||||
.hint = hintfmt("cannot build on '%s': %s%s",
|
.hint = hintfmt("cannot build on '%s': %s%s",
|
||||||
bestMachine->storeUri, e.what(),
|
bestMachine->storeUri, e.what(),
|
||||||
|
|
|
@ -62,46 +62,41 @@ int main()
|
||||||
|
|
||||||
// For completeness sake, show 'info' through 'vomit' levels.
|
// For completeness sake, show 'info' through 'vomit' levels.
|
||||||
// But this is maybe a heavy format for those.
|
// But this is maybe a heavy format for those.
|
||||||
logger->logEI(
|
logger->logEI({ .level = lvlInfo,
|
||||||
ErrorInfo { .level = lvlInfo,
|
|
||||||
.name = "Info name",
|
.name = "Info name",
|
||||||
.description = "Info description",
|
.description = "Info description",
|
||||||
});
|
});
|
||||||
|
|
||||||
logger->logEI(
|
logger->logEI({ .level = lvlTalkative,
|
||||||
ErrorInfo { .level = lvlTalkative,
|
|
||||||
.name = "Talkative name",
|
.name = "Talkative name",
|
||||||
.description = "Talkative description",
|
.description = "Talkative description",
|
||||||
});
|
});
|
||||||
|
|
||||||
logger->logEI(
|
logger->logEI({ .level = lvlChatty,
|
||||||
ErrorInfo { .level = lvlChatty,
|
|
||||||
.name = "Chatty name",
|
.name = "Chatty name",
|
||||||
.description = "Chatty description",
|
.description = "Chatty description",
|
||||||
});
|
});
|
||||||
|
|
||||||
logger->logEI(
|
logger->logEI({ .level = lvlDebug,
|
||||||
ErrorInfo { .level = lvlDebug,
|
|
||||||
.name = "Debug name",
|
.name = "Debug name",
|
||||||
.description = "Debug description",
|
.description = "Debug description",
|
||||||
});
|
});
|
||||||
|
|
||||||
logger->logEI(
|
logger->logEI({ .level = lvlVomit,
|
||||||
ErrorInfo { .level = lvlVomit,
|
|
||||||
.name = "Vomit name",
|
.name = "Vomit name",
|
||||||
.description = "Vomit description",
|
.description = "Vomit description",
|
||||||
});
|
});
|
||||||
|
|
||||||
// Error in a program; no hint and no nix code.
|
// Error in a program; no hint and no nix code.
|
||||||
logError(
|
logError({
|
||||||
ErrorInfo { .name = "name",
|
.name = "name",
|
||||||
.description = "error description",
|
.description = "error description",
|
||||||
});
|
});
|
||||||
|
|
||||||
// Warning with name, description, and hint.
|
// Warning with name, description, and hint.
|
||||||
// The hintfmt function makes all the substituted text yellow.
|
// The hintfmt function makes all the substituted text yellow.
|
||||||
logWarning(
|
logWarning({
|
||||||
ErrorInfo { .name = "name",
|
.name = "name",
|
||||||
.description = "error description",
|
.description = "error description",
|
||||||
.hint = hintfmt("there was a %1%", "warning"),
|
.hint = hintfmt("there was a %1%", "warning"),
|
||||||
});
|
});
|
||||||
|
@ -111,8 +106,8 @@ int main()
|
||||||
SymbolTable testTable;
|
SymbolTable testTable;
|
||||||
auto problem_file = testTable.create("myfile.nix");
|
auto problem_file = testTable.create("myfile.nix");
|
||||||
|
|
||||||
logWarning(
|
logWarning({
|
||||||
ErrorInfo { .name = "warning name",
|
.name = "warning name",
|
||||||
.description = "warning description",
|
.description = "warning description",
|
||||||
.hint = hintfmt("this hint has %1% templated %2%!!",
|
.hint = hintfmt("this hint has %1% templated %2%!!",
|
||||||
"yellow",
|
"yellow",
|
||||||
|
@ -125,8 +120,8 @@ int main()
|
||||||
}});
|
}});
|
||||||
|
|
||||||
// Error with previous and next lines of code.
|
// Error with previous and next lines of code.
|
||||||
logError(
|
logError({
|
||||||
ErrorInfo { .name = "error name",
|
.name = "error name",
|
||||||
.description = "error with code lines",
|
.description = "error with code lines",
|
||||||
.hint = hintfmt("this hint has %1% templated %2%!!",
|
.hint = hintfmt("this hint has %1% templated %2%!!",
|
||||||
"yellow",
|
"yellow",
|
||||||
|
@ -140,8 +135,8 @@ int main()
|
||||||
|
|
||||||
|
|
||||||
// Error without lines of code.
|
// Error without lines of code.
|
||||||
logError(
|
logError({
|
||||||
ErrorInfo { .name = "error name",
|
.name = "error name",
|
||||||
.description = "error without any code lines.",
|
.description = "error without any code lines.",
|
||||||
.hint = hintfmt("this hint has %1% templated %2%!!",
|
.hint = hintfmt("this hint has %1% templated %2%!!",
|
||||||
"yellow",
|
"yellow",
|
||||||
|
@ -151,8 +146,8 @@ int main()
|
||||||
}});
|
}});
|
||||||
|
|
||||||
// Error with only hint and name..
|
// Error with only hint and name..
|
||||||
logError(
|
logError({
|
||||||
ErrorInfo { .name = "error name",
|
.name = "error name",
|
||||||
.hint = hintfmt("hint %1%", "only"),
|
.hint = hintfmt("hint %1%", "only"),
|
||||||
.nixCode = NixCode {
|
.nixCode = NixCode {
|
||||||
.errPos = Pos(problem_file, 40, 13)
|
.errPos = Pos(problem_file, 40, 13)
|
||||||
|
|
|
@ -1158,8 +1158,7 @@ void DerivationGoal::loadDerivation()
|
||||||
trace("loading derivation");
|
trace("loading derivation");
|
||||||
|
|
||||||
if (nrFailed != 0) {
|
if (nrFailed != 0) {
|
||||||
logError(
|
logError({
|
||||||
ErrorInfo {
|
|
||||||
.name = "missing derivation during build",
|
.name = "missing derivation during build",
|
||||||
.hint = hintfmt("cannot build missing derivation '%s'", worker.store.printStorePath(drvPath))
|
.hint = hintfmt("cannot build missing derivation '%s'", worker.store.printStorePath(drvPath))
|
||||||
});
|
});
|
||||||
|
@ -1313,8 +1312,7 @@ void DerivationGoal::repairClosure()
|
||||||
/* Check each path (slow!). */
|
/* Check each path (slow!). */
|
||||||
for (auto & i : outputClosure) {
|
for (auto & i : outputClosure) {
|
||||||
if (worker.pathContentsGood(i)) continue;
|
if (worker.pathContentsGood(i)) continue;
|
||||||
logError(
|
logError({
|
||||||
ErrorInfo {
|
|
||||||
.name = "Corrupt path in closure",
|
.name = "Corrupt path in closure",
|
||||||
.hint = hintfmt(
|
.hint = hintfmt(
|
||||||
"found corrupted or missing path '%s' in the output closure of '%s'",
|
"found corrupted or missing path '%s' in the output closure of '%s'",
|
||||||
|
@ -1353,8 +1351,7 @@ void DerivationGoal::inputsRealised()
|
||||||
if (nrFailed != 0) {
|
if (nrFailed != 0) {
|
||||||
if (!useDerivation)
|
if (!useDerivation)
|
||||||
throw Error("some dependencies of '%s' are missing", worker.store.printStorePath(drvPath));
|
throw Error("some dependencies of '%s' are missing", worker.store.printStorePath(drvPath));
|
||||||
logError(
|
logError({
|
||||||
ErrorInfo {
|
|
||||||
.name = "Dependencies could not be built",
|
.name = "Dependencies could not be built",
|
||||||
.hint = hintfmt(
|
.hint = hintfmt(
|
||||||
"cannot build derivation '%s': %s dependencies couldn't be built",
|
"cannot build derivation '%s': %s dependencies couldn't be built",
|
||||||
|
@ -1844,8 +1841,7 @@ HookReply DerivationGoal::tryBuildHook()
|
||||||
|
|
||||||
} catch (SysError & e) {
|
} catch (SysError & e) {
|
||||||
if (e.errNo == EPIPE) {
|
if (e.errNo == EPIPE) {
|
||||||
logError(
|
logError({
|
||||||
ErrorInfo {
|
|
||||||
.name = "Build hook died",
|
.name = "Build hook died",
|
||||||
.hint = hintfmt(
|
.hint = hintfmt(
|
||||||
"build hook died unexpectedly: %s",
|
"build hook died unexpectedly: %s",
|
||||||
|
@ -3692,8 +3688,7 @@ void DerivationGoal::registerOutputs()
|
||||||
/* Apply hash rewriting if necessary. */
|
/* Apply hash rewriting if necessary. */
|
||||||
bool rewritten = false;
|
bool rewritten = false;
|
||||||
if (!outputRewrites.empty()) {
|
if (!outputRewrites.empty()) {
|
||||||
logWarning(
|
logWarning({
|
||||||
ErrorInfo {
|
|
||||||
.name = "Rewriting hashes",
|
.name = "Rewriting hashes",
|
||||||
.hint = hintfmt("rewriting hashes in '%1%'; cross fingers", path)
|
.hint = hintfmt("rewriting hashes in '%1%'; cross fingers", path)
|
||||||
});
|
});
|
||||||
|
@ -3875,8 +3870,7 @@ void DerivationGoal::registerOutputs()
|
||||||
if (settings.enforceDeterminism)
|
if (settings.enforceDeterminism)
|
||||||
throw NotDeterministic(hint);
|
throw NotDeterministic(hint);
|
||||||
|
|
||||||
logError(
|
logError({
|
||||||
ErrorInfo {
|
|
||||||
.name = "Output determinism error",
|
.name = "Output determinism error",
|
||||||
.hint = hint
|
.hint = hint
|
||||||
});
|
});
|
||||||
|
@ -4145,8 +4139,7 @@ void DerivationGoal::handleChildOutput(int fd, const string & data)
|
||||||
{
|
{
|
||||||
logSize += data.size();
|
logSize += data.size();
|
||||||
if (settings.maxLogSize && logSize > settings.maxLogSize) {
|
if (settings.maxLogSize && logSize > settings.maxLogSize) {
|
||||||
logError(
|
logError({
|
||||||
ErrorInfo {
|
|
||||||
.name = "Max log size exceeded",
|
.name = "Max log size exceeded",
|
||||||
.hint = hintfmt(
|
.hint = hintfmt(
|
||||||
"%1% killed after writing more than %2% bytes of log output",
|
"%1% killed after writing more than %2% bytes of log output",
|
||||||
|
@ -4467,8 +4460,7 @@ void SubstitutionGoal::tryNext()
|
||||||
&& !sub->isTrusted
|
&& !sub->isTrusted
|
||||||
&& !info->checkSignatures(worker.store, worker.store.getPublicKeys()))
|
&& !info->checkSignatures(worker.store, worker.store.getPublicKeys()))
|
||||||
{
|
{
|
||||||
logWarning(
|
logWarning({
|
||||||
ErrorInfo {
|
|
||||||
.name = "Invalid path signature",
|
.name = "Invalid path signature",
|
||||||
.hint = hintfmt("substituter '%s' does not have a valid signature for path '%s'",
|
.hint = hintfmt("substituter '%s' does not have a valid signature for path '%s'",
|
||||||
sub->getUri(), worker.store.printStorePath(storePath))
|
sub->getUri(), worker.store.printStorePath(storePath))
|
||||||
|
@ -4954,8 +4946,7 @@ void Worker::waitForInput()
|
||||||
j->respectTimeouts &&
|
j->respectTimeouts &&
|
||||||
after - j->lastOutput >= std::chrono::seconds(settings.maxSilentTime))
|
after - j->lastOutput >= std::chrono::seconds(settings.maxSilentTime))
|
||||||
{
|
{
|
||||||
logError(
|
logError({
|
||||||
ErrorInfo {
|
|
||||||
.name = "Silent build timeout",
|
.name = "Silent build timeout",
|
||||||
.hint = hintfmt(
|
.hint = hintfmt(
|
||||||
"%1% timed out after %2% seconds of silence",
|
"%1% timed out after %2% seconds of silence",
|
||||||
|
@ -4969,8 +4960,7 @@ void Worker::waitForInput()
|
||||||
j->respectTimeouts &&
|
j->respectTimeouts &&
|
||||||
after - j->timeStarted >= std::chrono::seconds(settings.buildTimeout))
|
after - j->timeStarted >= std::chrono::seconds(settings.buildTimeout))
|
||||||
{
|
{
|
||||||
logError(
|
logError({
|
||||||
ErrorInfo {
|
|
||||||
.name = "Build timeout",
|
.name = "Build timeout",
|
||||||
.hint = hintfmt(
|
.hint = hintfmt(
|
||||||
"%1% timed out after %2% seconds",
|
"%1% timed out after %2% seconds",
|
||||||
|
@ -5035,8 +5025,7 @@ bool Worker::pathContentsGood(const StorePath & path)
|
||||||
}
|
}
|
||||||
pathContentsGoodCache.insert_or_assign(path.clone(), res);
|
pathContentsGoodCache.insert_or_assign(path.clone(), res);
|
||||||
if (!res)
|
if (!res)
|
||||||
logError(
|
logError({
|
||||||
ErrorInfo {
|
|
||||||
.name = "Corrupted path",
|
.name = "Corrupted path",
|
||||||
.hint = hintfmt("path '%s' is corrupted or missing!", store.printStorePath(path))
|
.hint = hintfmt("path '%s' is corrupted or missing!", store.printStorePath(path))
|
||||||
});
|
});
|
||||||
|
|
|
@ -599,8 +599,7 @@ struct curlFileTransfer : public FileTransfer
|
||||||
workerThreadMain();
|
workerThreadMain();
|
||||||
} catch (nix::Interrupted & e) {
|
} catch (nix::Interrupted & e) {
|
||||||
} catch (std::exception & e) {
|
} catch (std::exception & e) {
|
||||||
logError(
|
logError({
|
||||||
ErrorInfo {
|
|
||||||
.name = "File transfer",
|
.name = "File transfer",
|
||||||
.hint = hintfmt("unexpected error in download thread: %s",
|
.hint = hintfmt("unexpected error in download thread: %s",
|
||||||
e.what())
|
e.what())
|
||||||
|
|
|
@ -87,8 +87,7 @@ LocalStore::LocalStore(const Params & params)
|
||||||
|
|
||||||
struct group * gr = getgrnam(settings.buildUsersGroup.get().c_str());
|
struct group * gr = getgrnam(settings.buildUsersGroup.get().c_str());
|
||||||
if (!gr)
|
if (!gr)
|
||||||
logError(
|
logError({
|
||||||
ErrorInfo {
|
|
||||||
.name = "'build-users-group' not found",
|
.name = "'build-users-group' not found",
|
||||||
.hint = hintfmt(
|
.hint = hintfmt(
|
||||||
"warning: the group '%1%' specified in 'build-users-group' does not exist",
|
"warning: the group '%1%' specified in 'build-users-group' does not exist",
|
||||||
|
@ -1242,8 +1241,7 @@ bool LocalStore::verifyStore(bool checkContents, RepairFlag repair)
|
||||||
Path linkPath = linksDir + "/" + link.name;
|
Path linkPath = linksDir + "/" + link.name;
|
||||||
string hash = hashPath(htSHA256, linkPath).first.to_string(Base32, false);
|
string hash = hashPath(htSHA256, linkPath).first.to_string(Base32, false);
|
||||||
if (hash != link.name) {
|
if (hash != link.name) {
|
||||||
logError(
|
logError({
|
||||||
ErrorInfo {
|
|
||||||
.name = "Invalid hash",
|
.name = "Invalid hash",
|
||||||
.hint = hintfmt(
|
.hint = hintfmt(
|
||||||
"link '%s' was modified! expected hash '%s', got '%s'",
|
"link '%s' was modified! expected hash '%s', got '%s'",
|
||||||
|
@ -1281,8 +1279,7 @@ bool LocalStore::verifyStore(bool checkContents, RepairFlag repair)
|
||||||
auto current = hashSink->finish();
|
auto current = hashSink->finish();
|
||||||
|
|
||||||
if (info->narHash != nullHash && info->narHash != current.first) {
|
if (info->narHash != nullHash && info->narHash != current.first) {
|
||||||
logError(
|
logError({
|
||||||
ErrorInfo {
|
|
||||||
.name = "Invalid hash - path modified",
|
.name = "Invalid hash - path modified",
|
||||||
.hint = hintfmt("path '%s' was modified! expected hash '%s', got '%s'",
|
.hint = hintfmt("path '%s' was modified! expected hash '%s', got '%s'",
|
||||||
printStorePath(i), info->narHash.to_string(), current.first.to_string())
|
printStorePath(i), info->narHash.to_string(), current.first.to_string())
|
||||||
|
@ -1337,8 +1334,7 @@ void LocalStore::verifyPath(const Path & pathS, const StringSet & store,
|
||||||
if (!done.insert(pathS).second) return;
|
if (!done.insert(pathS).second) return;
|
||||||
|
|
||||||
if (!isStorePath(pathS)) {
|
if (!isStorePath(pathS)) {
|
||||||
logError(
|
logError({
|
||||||
ErrorInfo {
|
|
||||||
.name = "Nix path not found",
|
.name = "Nix path not found",
|
||||||
.hint = hintfmt("path '%s' is not in the Nix store", pathS)
|
.hint = hintfmt("path '%s' is not in the Nix store", pathS)
|
||||||
});
|
});
|
||||||
|
@ -1364,8 +1360,7 @@ void LocalStore::verifyPath(const Path & pathS, const StringSet & store,
|
||||||
auto state(_state.lock());
|
auto state(_state.lock());
|
||||||
invalidatePath(*state, path);
|
invalidatePath(*state, path);
|
||||||
} else {
|
} else {
|
||||||
logError(
|
logError({
|
||||||
ErrorInfo {
|
|
||||||
.name = "Missing path with referrers",
|
.name = "Missing path with referrers",
|
||||||
.hint = hintfmt("path '%s' disappeared, but it still has valid referrers!", pathS)
|
.hint = hintfmt("path '%s' disappeared, but it still has valid referrers!", pathS)
|
||||||
});
|
});
|
||||||
|
|
|
@ -130,8 +130,7 @@ void LocalStore::optimisePath_(Activity * act, OptimiseStats & stats,
|
||||||
NixOS (example: $fontconfig/var/cache being modified). Skip
|
NixOS (example: $fontconfig/var/cache being modified). Skip
|
||||||
those files. FIXME: check the modification time. */
|
those files. FIXME: check the modification time. */
|
||||||
if (S_ISREG(st.st_mode) && (st.st_mode & S_IWUSR)) {
|
if (S_ISREG(st.st_mode) && (st.st_mode & S_IWUSR)) {
|
||||||
logWarning(
|
logWarning({
|
||||||
ErrorInfo {
|
|
||||||
.name = "Suspicious file",
|
.name = "Suspicious file",
|
||||||
.hint = hintfmt("skipping suspicious writable file '%1%'", path)
|
.hint = hintfmt("skipping suspicious writable file '%1%'", path)
|
||||||
});
|
});
|
||||||
|
@ -198,8 +197,7 @@ void LocalStore::optimisePath_(Activity * act, OptimiseStats & stats,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (st.st_size != stLink.st_size) {
|
if (st.st_size != stLink.st_size) {
|
||||||
logWarning(
|
logWarning({
|
||||||
ErrorInfo {
|
|
||||||
.name = "Corrupted link",
|
.name = "Corrupted link",
|
||||||
.hint = hintfmt("removing corrupted link '%1%'", linkPath)
|
.hint = hintfmt("removing corrupted link '%1%'", linkPath)
|
||||||
});
|
});
|
||||||
|
@ -237,8 +235,7 @@ void LocalStore::optimisePath_(Activity * act, OptimiseStats & stats,
|
||||||
/* Atomically replace the old file with the new hard link. */
|
/* Atomically replace the old file with the new hard link. */
|
||||||
if (rename(tempLink.c_str(), path.c_str()) == -1) {
|
if (rename(tempLink.c_str(), path.c_str()) == -1) {
|
||||||
if (unlink(tempLink.c_str()) == -1)
|
if (unlink(tempLink.c_str()) == -1)
|
||||||
logError(
|
logError({
|
||||||
ErrorInfo {
|
|
||||||
.name = "Unlink error",
|
.name = "Unlink error",
|
||||||
.hint = hintfmt("unable to unlink '%1%'", tempLink)
|
.hint = hintfmt("unable to unlink '%1%'", tempLink)
|
||||||
});
|
});
|
||||||
|
|
|
@ -251,8 +251,7 @@ bool handleJSONLogMessage(const std::string & msg,
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (std::exception & e) {
|
} catch (std::exception & e) {
|
||||||
logError(
|
logError({
|
||||||
ErrorInfo {
|
|
||||||
.name = "Json log message",
|
.name = "Json log message",
|
||||||
.hint = hintfmt("bad log message from builder: %s", e.what())
|
.hint = hintfmt("bad log message from builder: %s", e.what())
|
||||||
});
|
});
|
||||||
|
|
|
@ -123,8 +123,7 @@ static void getAllExprs(EvalState & state,
|
||||||
if (hasSuffix(attrName, ".nix"))
|
if (hasSuffix(attrName, ".nix"))
|
||||||
attrName = string(attrName, 0, attrName.size() - 4);
|
attrName = string(attrName, 0, attrName.size() - 4);
|
||||||
if (!attrs.insert(attrName).second) {
|
if (!attrs.insert(attrName).second) {
|
||||||
logError(
|
logError({
|
||||||
ErrorInfo {
|
|
||||||
.name = "Name collision",
|
.name = "Name collision",
|
||||||
.hint = hintfmt("warning: name collision in input Nix expressions, skipping '%1%'", path2)
|
.hint = hintfmt("warning: name collision in input Nix expressions, skipping '%1%'", path2)
|
||||||
});
|
});
|
||||||
|
@ -875,8 +874,7 @@ static void queryJSON(Globals & globals, vector<DrvInfo> & elems)
|
||||||
auto placeholder = metaObj.placeholder(j);
|
auto placeholder = metaObj.placeholder(j);
|
||||||
Value * v = i.queryMeta(j);
|
Value * v = i.queryMeta(j);
|
||||||
if (!v) {
|
if (!v) {
|
||||||
logError(
|
logError({
|
||||||
ErrorInfo {
|
|
||||||
.name = "Invalid meta attribute",
|
.name = "Invalid meta attribute",
|
||||||
.hint = hintfmt("derivation '%s' has invalid meta attribute '%s'",
|
.hint = hintfmt("derivation '%s' has invalid meta attribute '%s'",
|
||||||
i.queryName(), j)
|
i.queryName(), j)
|
||||||
|
@ -1131,8 +1129,7 @@ static void opQuery(Globals & globals, Strings opFlags, Strings opArgs)
|
||||||
attrs2["name"] = j;
|
attrs2["name"] = j;
|
||||||
Value * v = i.queryMeta(j);
|
Value * v = i.queryMeta(j);
|
||||||
if (!v)
|
if (!v)
|
||||||
logError(
|
logError({
|
||||||
ErrorInfo {
|
|
||||||
.name = "Invalid meta attribute",
|
.name = "Invalid meta attribute",
|
||||||
.hint = hintfmt(
|
.hint = hintfmt(
|
||||||
"derivation '%s' has invalid meta attribute '%s'",
|
"derivation '%s' has invalid meta attribute '%s'",
|
||||||
|
|
|
@ -704,7 +704,7 @@ static void opVerify(Strings opFlags, Strings opArgs)
|
||||||
else throw UsageError("unknown flag '%1%'", i);
|
else throw UsageError("unknown flag '%1%'", i);
|
||||||
|
|
||||||
if (store->verifyStore(checkContents, repair)) {
|
if (store->verifyStore(checkContents, repair)) {
|
||||||
logWarning(ErrorInfo {
|
logWarning({
|
||||||
.name = "Store consistency",
|
.name = "Store consistency",
|
||||||
.description = "not all errors were fixed"
|
.description = "not all errors were fixed"
|
||||||
});
|
});
|
||||||
|
@ -729,8 +729,7 @@ static void opVerifyPath(Strings opFlags, Strings opArgs)
|
||||||
store->narFromPath(path, sink);
|
store->narFromPath(path, sink);
|
||||||
auto current = sink.finish();
|
auto current = sink.finish();
|
||||||
if (current.first != info->narHash) {
|
if (current.first != info->narHash) {
|
||||||
logError(
|
logError({
|
||||||
ErrorInfo {
|
|
||||||
.name = "Hash mismatch",
|
.name = "Hash mismatch",
|
||||||
.hint = hintfmt(
|
.hint = hintfmt(
|
||||||
"path '%s' was modified! expected hash '%s', got '%s'",
|
"path '%s' was modified! expected hash '%s', got '%s'",
|
||||||
|
|
|
@ -99,8 +99,7 @@ struct CmdVerify : StorePathsCommand
|
||||||
if (hash.first != info->narHash) {
|
if (hash.first != info->narHash) {
|
||||||
corrupted++;
|
corrupted++;
|
||||||
act2.result(resCorruptedPath, store->printStorePath(info->path));
|
act2.result(resCorruptedPath, store->printStorePath(info->path));
|
||||||
logError(
|
logError({
|
||||||
ErrorInfo {
|
|
||||||
.name = "Hash error - path modified",
|
.name = "Hash error - path modified",
|
||||||
.hint = hintfmt(
|
.hint = hintfmt(
|
||||||
"path '%s' was modified! expected hash '%s', got '%s'",
|
"path '%s' was modified! expected hash '%s', got '%s'",
|
||||||
|
@ -156,8 +155,7 @@ struct CmdVerify : StorePathsCommand
|
||||||
if (!good) {
|
if (!good) {
|
||||||
untrusted++;
|
untrusted++;
|
||||||
act2.result(resUntrustedPath, store->printStorePath(info->path));
|
act2.result(resUntrustedPath, store->printStorePath(info->path));
|
||||||
logError(
|
logError({
|
||||||
ErrorInfo {
|
|
||||||
.name = "Untrusted path",
|
.name = "Untrusted path",
|
||||||
.hint = hintfmt("path '%s' is untrusted",
|
.hint = hintfmt("path '%s' is untrusted",
|
||||||
store->printStorePath(info->path))
|
store->printStorePath(info->path))
|
||||||
|
|
|
@ -39,8 +39,7 @@ std::set<std::string> runResolver(const Path & filename)
|
||||||
throw SysError("statting '%s'", filename);
|
throw SysError("statting '%s'", filename);
|
||||||
|
|
||||||
if (!S_ISREG(st.st_mode)) {
|
if (!S_ISREG(st.st_mode)) {
|
||||||
logError(
|
logError({
|
||||||
ErrorInfo {
|
|
||||||
.name = "Regular MACH file",
|
.name = "Regular MACH file",
|
||||||
.hint = hintfmt("file '%s' is not a regular file", filename)
|
.hint = hintfmt("file '%s' is not a regular file", filename)
|
||||||
});
|
});
|
||||||
|
@ -48,8 +47,7 @@ std::set<std::string> runResolver(const Path & filename)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (st.st_size < sizeof(mach_header_64)) {
|
if (st.st_size < sizeof(mach_header_64)) {
|
||||||
logError(
|
logError({
|
||||||
ErrorInfo {
|
|
||||||
.name = "File too short",
|
.name = "File too short",
|
||||||
.hint = hintfmt("file '%s' is too short for a MACH binary", filename)
|
.hint = hintfmt("file '%s' is too short for a MACH binary", filename)
|
||||||
});
|
});
|
||||||
|
@ -74,8 +72,7 @@ std::set<std::string> runResolver(const Path & filename)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (mach64_offset == 0) {
|
if (mach64_offset == 0) {
|
||||||
logError(
|
logError({
|
||||||
ErrorInfo {
|
|
||||||
.name = "No mach64 blobs",
|
.name = "No mach64 blobs",
|
||||||
.hint = hintfmt("Could not find any mach64 blobs in file '%1%', continuing...", filename)
|
.hint = hintfmt("Could not find any mach64 blobs in file '%1%', continuing...", filename)
|
||||||
});
|
});
|
||||||
|
@ -84,8 +81,7 @@ std::set<std::string> runResolver(const Path & filename)
|
||||||
} else if (magic == MH_MAGIC_64 || magic == MH_CIGAM_64) {
|
} else if (magic == MH_MAGIC_64 || magic == MH_CIGAM_64) {
|
||||||
mach64_offset = 0;
|
mach64_offset = 0;
|
||||||
} else {
|
} else {
|
||||||
logError(
|
logError({
|
||||||
ErrorInfo {
|
|
||||||
.name = "Magic number",
|
.name = "Magic number",
|
||||||
.hint = hintfmt("Object file has unknown magic number '%1%', skipping it...", magic)
|
.hint = hintfmt("Object file has unknown magic number '%1%', skipping it...", magic)
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue