This is the mail archive of the
cygwin-apps
mailing list for the Cygwin project.
[PATCH] Another setup.exe infinite loop in unattended mode.
- From: Dave Korn <dave dot korn dot cygwin at googlemail dot com>
- To: cygwin-apps <cygwin-apps at cygwin dot com>
- Date: Sun, 22 Nov 2009 03:51:07 +0000
- Subject: [PATCH] Another setup.exe infinite loop in unattended mode.
Hi,
I found another one. In unattended mode, if the setup.ini download or
signature verification fails, we can loop forever trying again, because
there's no user to select a different mirror. A parallel problem exists if we
try and install from a local package dir with no or a corrupt setup.ini file.
The first case is worth retrying a few times, because it might just be a
network glitch; the second not.
(Note that this all only kicks in if *all* the selected mirrors / local
package dir setup.ini files are invalid.)
* threebar.cc (ThreeBarProgressPage::OnMessageApp): Don't loop forever
retrying ini file download/parse if it errors in unattended mode.
Ok?
cheers,
DaveK
Index: threebar.cc
===================================================================
RCS file: /cvs/cygwin-apps/setup/threebar.cc,v
retrieving revision 2.15
diff -p -u -r2.15 threebar.cc
--- threebar.cc 20 Jun 2009 21:54:22 -0000 2.15
+++ threebar.cc 22 Nov 2009 03:28:41 -0000
@@ -236,13 +236,33 @@ ThreeBarProgressPage::OnMessageApp (UINT
{
if (source == IDC_SOURCE_CWD)
{
- // There was a setup.ini file (as found by
- // do_fromcwd), but it had parse errors.
+ // There was a setup.ini file (as found by do_fromcwd), but it
+ // had parse errors. In unattended mode, don't retry even once,
+ // because we'll only loop forever.
+ if (unattended_mode)
+ {
+ log (LOG_PLAIN)
+ << "can't install from bad local package dir"
+ << endLog;
+ exit_msg = IDS_INSTALL_INCOMPLETE;
+ LogSingleton::GetInstance().exit (1);
+ }
GetOwner ()->SetActivePageByID (IDD_SOURCE);
}
else
{
- // Download failed, try another site.
+ // Download failed, try another site; in unattended mode, retry
+ // the same site a few times in case it was a transient network
+ // glitch, but don't loop forever.
+ static int retries = 4;
+ if (unattended_mode && retries-- <= 0)
+ {
+ log (LOG_PLAIN)
+ << "download/verify error in unattended_mode: out of retries"
+ << endLog;
+ exit_msg = IDS_INSTALL_INCOMPLETE;
+ LogSingleton::GetInstance().exit (1);
+ }
GetOwner ()->SetActivePageByID (IDD_SITE);
}
}