This is the mail archive of the cygwin-apps mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Setup.exe: don't download forever in unattended mode.


    Hi all,

  In unattended mode, setup.exe automatically answers "yes" to all message
boxes.  If the message box is asking whether to retry an incomplete download,
and the reason for the incomplete download is something non-transient, like
the localhost or the mirror going offline, or a file is missing from the
mirror, then it'll happily run forever.  This patch adds a simple retry limit
to the download stage in unattended mode; if it takes more than five goes, it
gives up.

	* download.cc (do_download_thread): Only retry an incomplete download
	a limited number of times in unattended mode.

  Tested on a local mirror, by removing a package file.  OK?

    cheers,
      DaveK
Index: download.cc
===================================================================
RCS file: /cvs/cygwin-apps/setup/download.cc,v
retrieving revision 2.50
diff -p -u -r2.50 download.cc
--- download.cc	19 Aug 2008 21:04:14 -0000	2.50
+++ download.cc	4 Nov 2009 16:31:39 -0000
@@ -275,10 +275,26 @@ do_download_thread (HINSTANCE h, HWND ow
 
   if (errors)
     {
-      if (yesno (owner, IDS_DOWNLOAD_INCOMPLETE) == IDYES)
-	{
+      /* In unattended mode, all dialog boxes automatically get
+         answered with a Yes/OK/other positive response.  This
+	 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)
+        {
+	  log (LOG_PLAIN) << "download error in unattended_mode: out of retries" << endLog;
+	  exit_msg = IDS_INSTALL_INCOMPLETE;
+	  LogSingleton::GetInstance().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;
     }
 
   if (source == IDC_SOURCE_DOWNLOAD)

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]