diff options
author | Ludovic Courtès <ludo@gnu.org> | 2017-05-30 17:52:55 +0200 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2017-05-30 18:08:37 +0200 |
commit | f0a0b58bfa9b62de1839b980a2560618e56f9249 (patch) | |
tree | 9c72c7ddea4f7c67ef45f9e4d2bf36f1692bd194 /nix/libstore | |
parent | a88d41d11c4aa9d29eb92cb961b23e447ec086a4 (diff) | |
download | guix-f0a0b58bfa9b62de1839b980a2560618e56f9249.tar guix-f0a0b58bfa9b62de1839b980a2560618e56f9249.tar.gz |
daemon: Report hash mismatches in a cleaner way.
Suggested by Hartmut Goebel.
* nix/libstore/build.cc (DerivationGoal::registerOutputs): Report hash
mismatches on 3 lines for clarity.
(SubstitutionGoal::finished): Likewise.
Diffstat (limited to 'nix/libstore')
-rw-r--r-- | nix/libstore/build.cc | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/nix/libstore/build.cc b/nix/libstore/build.cc index 9b7bb5391c..a93095dd1e 100644 --- a/nix/libstore/build.cc +++ b/nix/libstore/build.cc @@ -2449,8 +2449,11 @@ void DerivationGoal::registerOutputs() Hash h2 = recursive ? hashPath(ht, actualPath).first : hashFile(ht, actualPath); if (h != h2) throw BuildError( - format("output path `%1%' should have %2% hash `%3%', instead has `%4%'") - % path % i->second.hashAlgo % printHash16or32(h) % printHash16or32(h2)); + format("%1% hash mismatch for output path `%2%'\n" + " expected: %3%\n" + " actual: %4%") + % i->second.hashAlgo % path + % printHash16or32(h) % printHash16or32(h2)); } /* Get rid of all weird permissions. This also checks that @@ -3096,7 +3099,9 @@ void SubstitutionGoal::finished() Hash expectedHash = parseHash16or32(hashType, string(expectedHashStr, n + 1)); Hash actualHash = hashType == htSHA256 ? hash.first : hashPath(hashType, destPath).first; if (expectedHash != actualHash) - throw SubstError(format("hash mismatch in downloaded path `%1%': expected %2%, got %3%") + throw SubstError(format("hash mismatch in downloaded path `%1%'\n" + " expected: %2%\n" + " actual: %3%") % storePath % printHash(expectedHash) % printHash(actualHash)); } |