public inbox for cygwin-apps@cygwin.com
 help / color / mirror / Atom feed
From: Ken Brown <kbrown@cornell.edu>
To: Jon Turney <jon.turney@dronecode.org.uk>
Cc: cygwin-apps@cygwin.com
Subject: Re: [PATCH setup] Query the user if a corrupt local file is found
Date: Fri, 05 Jan 2018 23:26:00 -0000	[thread overview]
Message-ID: <0f9e9636-b821-d7ab-f2e3-e0f8af31c378@cornell.edu> (raw)
In-Reply-To: <86ba78c3-de97-6edf-613b-8483b3920851@dronecode.org.uk>

On 1/5/2018 10:00 AM, Jon Turney wrote:
> 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...

I agree.  It's strange that the code for size checking is currently in 
download.cc, and the code for hash checking is currently in install.cc. 
All of this checking should probably be done in a 
packagesource::validate() function, which can be called during both the 
download and install stages.

I'll work on this and send a new patch.

Ken

      reply	other threads:[~2018-01-05 23:26 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
2018-01-05 23:26   ` Ken Brown [this message]

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=0f9e9636-b821-d7ab-f2e3-e0f8af31c378@cornell.edu \
    --to=kbrown@cornell.edu \
    --cc=cygwin-apps@cygwin.com \
    --cc=jon.turney@dronecode.org.uk \
    /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).