public inbox for cygwin-apps@cygwin.com
 help / color / mirror / Atom feed
* [PATCH setup] Fix spinning after replace-on-reboot failure or skipped
@ 2017-10-18 16:14 Jon Turney
  0 siblings, 0 replies; only message in thread
From: Jon Turney @ 2017-10-18 16:14 UTC (permalink / raw)
  To: cygwin-apps; +Cc: Jon Turney

If:
- extracting a file failed AND --no-replaceonreboot was used
- OR, writing the .new file for replacing on reboot failed
we don't advance to the next file in the archive, so we just sit there,
trying the same operation repeatedly.

Yes, this seems to mean that --no-replaceonreboot never worked usefully.

Also advance to next file in extract_other error case.

See https://cygwin.com/ml/cygwin/2017-10/msg00090.html

Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
---
 install.cc | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/install.cc b/install.cc
index f8f0b59..a47edcd 100644
--- a/install.cc
+++ b/install.cc
@@ -498,6 +498,8 @@ Installer::installOne (packagemeta &pkgm, const packageversion &ver,
       archive::extract_results extres;
       while ((extres = archive::extract_file (tarstream, prefixURL, prefixPath)) != archive::extract_ok)
         {
+          bool error_in_this_file = false;
+
           switch (extres)
             {
 	    case archive::extract_inuse: // in use
@@ -602,13 +604,13 @@ Installer::installOne (packagemeta &pkgm, const packageversion &ver,
                 if (NoReplaceOnReboot)
                   {
                     ++errors;
-                    error_in_this_package = true;
+                    error_in_this_file = true;
                     Log (LOG_PLAIN) << "Not replacing in-use file " << prefixURL
                                     << prefixPath << fn << endLog;
                   }
                 else
                   {
-                    error_in_this_package = extract_replace_on_reboot(tarstream, prefixURL, prefixPath, fn);
+                    error_in_this_file = extract_replace_on_reboot(tarstream, prefixURL, prefixPath, fn);
                   }
               }
               break;
@@ -633,8 +635,7 @@ Installer::installOne (packagemeta &pkgm, const packageversion &ver,
                           MB_OK | MB_ICONWARNING | MB_TASKMODAL);
                   }
 
-                // don't mark this package as successfully installed
-                error_in_this_package = true;
+                error_in_this_file = true;
               }
               break;
 	    case archive::extract_ok:
@@ -642,6 +643,16 @@ Installer::installOne (packagemeta &pkgm, const packageversion &ver,
             }
 
           // We're done with this file
+
+          // if an error occured ...
+          if (error_in_this_file)
+            {
+              // skip to next file in archive
+              tarstream->skip_file();
+              // don't mark this package as successfully installed
+              error_in_this_package = true;
+            }
+
           break;
         }
       progress (pkgfile->tell ());
-- 
2.14.2

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2017-10-18 16:14 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-18 16:14 [PATCH setup] Fix spinning after replace-on-reboot failure or skipped Jon Turney

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).