From: Jon Turney <jon.turney@dronecode.org.uk>
To: Ken Brown <kbrown@cornell.edu>
Cc: cygwin-apps@cygwin.com
Subject: Re: [PATCH setup] Query the user if a corrupt local file is found
Date: Fri, 05 Jan 2018 15:00:00 -0000 [thread overview]
Message-ID: <86ba78c3-de97-6edf-613b-8483b3920851@dronecode.org.uk> (raw)
In-Reply-To: <20171216183731.10888-1-kbrown@cornell.edu>
On 16/12/2017 18:37, Ken Brown wrote:
> If a corrupt file is found in one of the selected mirror site
> directories, offer to delete it instead of making this a fatal error.
> Do this only on the first call to check_for cached(). If the corrupt
> file is still there on the second call, then the deletion failed, and
> the user will have to fix the problem.
>
> See https://cygwin.com/ml/cygwin/2017-12/msg00122.html for discussion.
This is a nice idea. But I think there are some structural problems
with this, though. e.g. validateCachedPackage() only checks the package
size, not hash (which happens in the install phase)
I'm also concerned about masking problems with how we got into this
state in the first place: I think either (i) a corrupt download was
stored into the cache, (ii) the valid size was changed between runs, or
(iii) the files contents actually got corrupted somehow.
(i) indicates another problem in setup
Uploading replacement packages, which would cause (ii) was permitted
historically (but of course, didn't work well), but now should be
forbidden by calm. This could, of course, still happen with a private
package repo, and should be handled sanely.
(iii) seems unlikely, barring deliberate action.
I guess the ideal solution looks something like:
Download:
- verify size/hash of cached packages, offer to remove corrupt ones
- download packages, verifying size/hash
Install:
- verify size/hash of cached packages, skip corrupt ones
- install packages
with some memory so that we don't verify size/hash for the same package
file more than once...
> ---
> download.cc | 17 ++++++++++++-----
> download.h | 4 +++-
> res.rc | 3 ++-
> resource.h | 1 +
> 4 files changed, 18 insertions(+), 7 deletions(-)
>
> diff --git a/download.cc b/download.cc
> index b606eb1..697f94a 100644
> --- a/download.cc
> +++ b/download.cc
> @@ -71,7 +71,7 @@ validateCachedPackage (const std::string& fullname, packagesource & pkgsource)
> /* 0 on failure
> */
> int
> -check_for_cached (packagesource & pkgsource, bool mirror_mode)
> +check_for_cached (packagesource & pkgsource, bool mirror_mode, bool query_corrupt, HWND owner)
> {
> // Already found one.
> if (pkgsource.Cached())
> @@ -114,6 +114,12 @@ check_for_cached (packagesource & pkgsource, bool mirror_mode)
> {
> if (validateCachedPackage (fullname, pkgsource)) > pkgsource.set_cached (fullname);
> + else if (query_corrupt && owner && !unattended_mode
I don't think you need to check for non-null owner here, as yesno() will
still work in that case
I kind of incline to doing the 'yes' action in unattended_mode, rather
than reporting a fatal error.
next prev parent reply other threads:[~2018-01-05 15:00 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-16 18:37 Ken Brown
2017-12-18 18:41 ` Ken Brown
2017-12-18 20:32 ` Ken Brown
2018-01-05 15:00 ` Jon Turney [this message]
2018-01-05 23:26 ` Ken Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=86ba78c3-de97-6edf-613b-8483b3920851@dronecode.org.uk \
--to=jon.turney@dronecode.org.uk \
--cc=cygwin-apps@cygwin.com \
--cc=kbrown@cornell.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).