From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 59324 invoked by alias); 6 Nov 2017 21:49:20 -0000 Mailing-List: contact cygwin-apps-help@cygwin.com; run by ezmlm Precedence: bulk Sender: cygwin-apps-owner@cygwin.com List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Mail-Followup-To: cygwin-apps@cygwin.com Received: (qmail 59297 invoked by uid 89); 6 Nov 2017 21:49:20 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.4 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 spammy=Download, BEGIN, Installation, H*m:edu X-HELO: limerock03.mail.cornell.edu Received: from limerock03.mail.cornell.edu (HELO limerock03.mail.cornell.edu) (128.84.13.243) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 06 Nov 2017 21:49:18 +0000 X-CornellRouted: This message has been Routed already. Received: from authusersmtp.mail.cornell.edu (granite3.serverfarm.cornell.edu [10.16.197.8]) by limerock03.mail.cornell.edu (8.14.4/8.14.4_cu) with ESMTP id vA6LnGSA022298; Mon, 6 Nov 2017 16:49:16 -0500 Received: from nothing.nyroc.rr.com (mta-68-175-129-7.twcny.rr.com [68.175.129.7] (may be forged)) (authenticated bits=0) by authusersmtp.mail.cornell.edu (8.14.4/8.12.10) with ESMTP id vA6Ln6Gn017144 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Mon, 6 Nov 2017 16:49:16 -0500 From: Ken Brown To: cygwin-apps@cygwin.com Subject: [PATCH setup 1/2] Improve behavior after download error Date: Mon, 06 Nov 2017 21:49:00 -0000 Message-Id: <20171106214907.7120-2-kbrown@cornell.edu> In-Reply-To: <20171106214907.7120-1-kbrown@cornell.edu> References: <20171106214907.7120-1-kbrown@cornell.edu> X-PMX-Cornell-Gauge: Gauge=XXXXX X-PMX-CORNELL-AUTH-RESULTS: dkim-out=none; X-IsSubscribed: yes X-SW-Source: 2017-11/txt/msg00017.txt.bz2 If the user answers "Yes" to "Download incomplete. Try again?", simply try the download again, as the message suggests, instead of going back to the site page. If the user answers no, don't proceed with the install unless the user confirms that this is what they want. The rationale for the previous behavior was presumably to let the user choose a different mirror after a download error. But this is not clear from the "Try again?" prompt, and it probably didn't work as expected if the user did choose a different mirror. To make this work right, packagedb would have to have been cleared before going to the chooser page for the second time. --- download.cc | 29 ++++++++++++++++++++--------- res.rc | 1 + resource.h | 1 + 3 files changed, 22 insertions(+), 9 deletions(-) diff --git a/download.cc b/download.cc index 80615f3..6ee64c1 100644 --- a/download.cc +++ b/download.cc @@ -195,6 +195,11 @@ static int do_download_thread (HINSTANCE h, HWND owner) { int errors = 0; + int retries = 5; + + do + { + errors = 0; total_download_bytes = 0; total_download_bytes_sofar = 0; @@ -271,22 +276,20 @@ do_download_thread (HINSTANCE h, HWND owner) means that if there's a download problem, setup will potentially retry forever if we don't take care to give up at some finite point. */ - static int retries = 4; - if (unattended_mode && retries-- <= 0) + if (unattended_mode && --retries <= 0) { Log (LOG_PLAIN) << "download error in unattended_mode: out of retries" << endLog; Logger ().setExitMsg (IDS_INSTALL_INCOMPLETE); Logger ().exit (1); } else if (unattended_mode) - { Log (LOG_PLAIN) << "download error in unattended_mode: " << retries << (retries > 1 ? " retries" : " retry") << " remaining." << endLog; - return IDD_SITE; - } - else if (yesno (owner, IDS_DOWNLOAD_INCOMPLETE) == IDYES) - return IDD_SITE; + else if (yesno (owner, IDS_DOWNLOAD_INCOMPLETE) == IDNO) + break; } + } + while (errors); if (source == IDC_SOURCE_DOWNLOAD) { @@ -296,8 +299,16 @@ do_download_thread (HINSTANCE h, HWND owner) Logger ().setExitMsg (IDS_DOWNLOAD_COMPLETE); return IDD_DESKTOP; } - else - return IDD_S_INSTALL; + + if (errors) + { + if (yesno (owner, IDS_CONTINUE_INSTALL) == IDNO) + { + Logger ().setExitMsg (IDS_INSTALL_INCOMPLETE); + Logger ().exit (1); + } + } + return IDD_S_INSTALL; } static DWORD WINAPI diff --git a/res.rc b/res.rc index 96dcf00..40e464b 100644 --- a/res.rc +++ b/res.rc @@ -523,6 +523,7 @@ BEGIN IDS_ERR_CHDIR "Could not change dir to %s: %s [%.8x]" IDS_OLD_SETUP_VERSION "This setup is version %s, but setup.ini claims version %s is available.\nYou might want to upgrade to get the latest features and bug fixes." IDS_DOWNLOAD_INCOMPLETE "Download Incomplete. Try again?" + IDS_CONTINUE_INSTALL "Download incomplete. Continue with install anyway?" 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." diff --git a/resource.h b/resource.h index a2add84..b6685e5 100644 --- a/resource.h +++ b/resource.h @@ -39,6 +39,7 @@ #define IDS_NO_LOCALDIR 138 #define IDS_ELEVATED 139 #define IDS_INSTALLEDB_VERSION 140 +#define IDS_CONTINUE_INSTALL 141 // Dialogs -- 2.15.0