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] Fix spinning after replace-on-reboot failure or skipped


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


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