aboutsummaryrefslogtreecommitdiff
path: root/src/nix/verify.cc
diff options
context:
space:
mode:
authorMatthew Bauer <mjbauer95@gmail.com>2020-06-17 13:18:47 -0400
committerMatthew Bauer <mjbauer95@gmail.com>2020-06-17 13:32:29 -0400
commit7bd88cc1dc746ed2883e1eaebb3230ec2c2bb035 (patch)
tree804e3731a5f6b4a370ac7f79c03c6fa0233ccc79 /src/nix/verify.cc
parent6438ba1e990ddf76602a70d5c1143b73ed31855c (diff)
parent2f51cd8dc95231b2e2f5b3bd75ac6d8d2dece361 (diff)
Merge remote-tracking branch 'origin/master' into substitute-other-storedir
Diffstat (limited to 'src/nix/verify.cc')
-rw-r--r--src/nix/verify.cc25
1 files changed, 17 insertions, 8 deletions
diff --git a/src/nix/verify.cc b/src/nix/verify.cc
index cf1fa6a99..ab83637dc 100644
--- a/src/nix/verify.cc
+++ b/src/nix/verify.cc
@@ -90,7 +90,7 @@ struct CmdVerify : StorePathsCommand
if (info->ca == "")
hashSink = std::make_unique<HashSink>(info->narHash.type);
else
- hashSink = std::make_unique<HashModuloSink>(info->narHash.type, storePathToHash(store->printStorePath(info->path)));
+ hashSink = std::make_unique<HashModuloSink>(info->narHash.type, std::string(info->path.hashPart()));
store->narFromPath(info->path, *hashSink);
@@ -99,11 +99,15 @@ struct CmdVerify : StorePathsCommand
if (hash.first != info->narHash) {
corrupted++;
act2.result(resCorruptedPath, store->printStorePath(info->path));
- printError(
- "path '%s' was modified! expected hash '%s', got '%s'",
- store->printStorePath(info->path), info->narHash.to_string(), hash.first.to_string());
+ logError({
+ .name = "Hash error - path modified",
+ .hint = hintfmt(
+ "path '%s' was modified! expected hash '%s', got '%s'",
+ store->printStorePath(info->path),
+ info->narHash.to_string(Base32, true),
+ hash.first.to_string(Base32, true))
+ });
}
-
}
if (!noTrust) {
@@ -139,7 +143,7 @@ struct CmdVerify : StorePathsCommand
doSigs(info2->sigs);
} catch (InvalidPath &) {
} catch (Error & e) {
- printError(format(ANSI_RED "error:" ANSI_NORMAL " %s") % e.what());
+ logError(e.info());
}
}
@@ -150,7 +154,12 @@ struct CmdVerify : StorePathsCommand
if (!good) {
untrusted++;
act2.result(resUntrustedPath, store->printStorePath(info->path));
- printError("path '%s' is untrusted", store->printStorePath(info->path));
+ logError({
+ .name = "Untrusted path",
+ .hint = hintfmt("path '%s' is untrusted",
+ store->printStorePath(info->path))
+ });
+
}
}
@@ -158,7 +167,7 @@ struct CmdVerify : StorePathsCommand
done++;
} catch (Error & e) {
- printError(format(ANSI_RED "error:" ANSI_NORMAL " %s") % e.what());
+ logError(e.info());
failed++;
}