summaryrefslogtreecommitdiff
path: root/apt-pkg/acquire-worker.cc
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2022-04-24 00:03:38 +0200
committerDavid Kalnischkies <david@kalnischkies.de>2024-11-22 12:21:24 +0000
commit496c8b4191790231258e644ac8cd4096d54f445f (patch)
tree64712f5e0cc56eda6b29a7a2c2d1fe097bb89fd1 /apt-pkg/acquire-worker.cc
parent39304fb440f62b3a9f4dd85871b7049fb5b8eb8f (diff)
Show hashes calculated by main thread in error messages
The main thread calculates the hash sums if the method hasn't to be able to verify the files, but while a failure is detected and reported, the error messages did not include the hash sums which looks at least puzzling. So to have a complete error message we ensure that the hashes we calculated are appended to the message from the method so that it looks for the higher level code as if the method had calculated the hashes.
Diffstat (limited to 'apt-pkg/acquire-worker.cc')
-rw-r--r--apt-pkg/acquire-worker.cc12
1 files changed, 12 insertions, 0 deletions
diff --git a/apt-pkg/acquire-worker.cc b/apt-pkg/acquire-worker.cc
index 035d8ce10..4c2acb5cc 100644
--- a/apt-pkg/acquire-worker.cc
+++ b/apt-pkg/acquire-worker.cc
@@ -457,6 +457,18 @@ bool pkgAcquire::Worker::RunMessages()
FileFd file(filename, FileFd::ReadOnly, FileFd::None);
calc.AddFD(file);
ReceivedHashes = calc.GetHashStringList();
+ for (auto const &h : ReceivedHashes)
+ {
+ std::string tagname;
+ if (AltFile)
+ tagname = "Alt-";
+ tagname.append(h.HashType()).append("-Hash");
+ if (not LookupTag(Message, tagname.c_str()).empty())
+ continue;
+ if (not APT::String::Endswith(Message, "\n"))
+ Message.append("\n");
+ Message.append(tagname).append(": ").append(h.HashValue());
+ }
}
}