On 10/01/2018 02:59, Ken Brown wrote:
Also reorganize package validation.
Move the size-validation code in download.cc and the hash-validation
code in install.cc into new member functions of the packagesource
class. Add a bool member 'validated' to the class to make sure that
the checking is done only once.
Change download.cc:check_for_cached() so that it offers to delete a
corrupt package file instead of throwing an exception. The latter
previously caused a fatal error when check_for_cached() was called
from do_download_thread and download_one. Now we get a fatal error
only if the user chooses not to delete the file.
Also make check_for_cached() check the hash of the file in addition to
the size. Similarly, check the hash in addition to the size after
downloading a file.
This looks great, thanks.
One minor comment, but please apply.
diff --git a/res.rc b/res.rc
index 82a9757..9648871 100644
--- a/res.rc
+++ b/res.rc
@@ -550,7 +550,8 @@ BEGIN
IDS_DOWNLOAD_INCOMPLETE_EXIT "Download incomplete. Check %s for details"
IDS_INSTALL_ERROR "Installation error (%s), Continue with other
packages?"
IDS_INSTALL_INCOMPLETE "Installation incomplete. Check %s for details"
- IDS_CORRUPT_PACKAGE "Package file %s has a corrupt local copy, please
remove and retry."
+ IDS_CORRUPT_PACKAGE "Package %s has a corrupt local copy, please remove and
retry."
+ IDS_QUERY_CORRUPT "The file %s is corrupt. Delete it?."
Perhaps this should say something like "Delete it and download again?"
IDS_SKIP_PACKAGE "%s\nDo you want to skip this package ?"
IDS_UNCAUGHT_EXCEPTION "Fatal Error: Uncaught Exception\nThread: %s\nType:
%s\nMessage: %s"
IDS_UNCAUGHT_EXCEPTION_WITH_ERRNO "Fatal Error: Uncaught Exception\nThread:
%s\nType: %s\nMessage: %s\nAppErrNo: %d"