public inbox for cygwin-apps@cygwin.com
 help / color / mirror / Atom feed
From: Jon Turney <jon.turney@dronecode.org.uk>
To: cygwin-apps@cygwin.com
Cc: Jon Turney <jon.turney@dronecode.org.uk>
Subject: [PATCH setup] Fix spinning after replace-on-reboot failure or skipped
Date: Wed, 18 Oct 2017 16:14:00 -0000	[thread overview]
Message-ID: <20171018161344.54840-1-jon.turney@dronecode.org.uk> (raw)

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

                 reply	other threads:[~2017-10-18 16:14 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171018161344.54840-1-jon.turney@dronecode.org.uk \
    --to=jon.turney@dronecode.org.uk \
    --cc=cygwin-apps@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).