aboutsummaryrefslogtreecommitdiff
path: root/src/nix/verify.cc
diff options
context:
space:
mode:
authorJohn Ericson <John.Ericson@Obsidian.Systems>2020-06-18 21:58:27 +0000
committerJohn Ericson <John.Ericson@Obsidian.Systems>2020-06-18 22:11:19 +0000
commitbbbf3602a323538b8da38f1a2c7ce136a20f74c6 (patch)
treee783d838d8a75d854e0b72eea03784c5909040bc /src/nix/verify.cc
parent406dbb7fce32f7d80b02f560d91c956698b58d6e (diff)
parent40526fbea56a8006eb7f1758d461a5acbe9a1694 (diff)
Merge branch 'enum-class' into no-hash-type-unknown
Diffstat (limited to 'src/nix/verify.cc')
-rw-r--r--src/nix/verify.cc24
1 files changed, 16 insertions, 8 deletions
diff --git a/src/nix/verify.cc b/src/nix/verify.cc
index fa05e7353..5b9175744 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(ResultType::CorruptedPath, 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(Base::Base32, true),
+ hash.first.to_string(Base::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,11 @@ struct CmdVerify : StorePathsCommand
if (!good) {
untrusted++;
act2.result(ResultType::UntrustedPath, 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 +166,7 @@ struct CmdVerify : StorePathsCommand
done++;
} catch (Error & e) {
- printError(format(ANSI_RED "error:" ANSI_NORMAL " %s") % e.what());
+ logError(e.info());
failed++;
}