diff options
author | John Ericson <John.Ericson@Obsidian.Systems> | 2020-06-18 21:38:15 +0000 |
---|---|---|
committer | John Ericson <John.Ericson@Obsidian.Systems> | 2020-06-18 21:38:15 +0000 |
commit | 40526fbea56a8006eb7f1758d461a5acbe9a1694 (patch) | |
tree | 5d74492a86f28fb7183897dc2a6d7baf2d24f7f1 /src/nix/verify.cc | |
parent | 6dd471ebf6b9a4996405398093ccb371b8abdf2f (diff) | |
parent | 6c000eed80565d83d596da800ca0db92e248342e (diff) |
Merge remote-tracking branch 'upstream/master' into enum-class
Diffstat (limited to 'src/nix/verify.cc')
-rw-r--r-- | src/nix/verify.cc | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/src/nix/verify.cc b/src/nix/verify.cc index 0c3478ff5..b7fdb301a 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++; } |