]> cygwin.com Git - cygwin-apps/setup.git/commitdiff
Fix cases where incorrect action is stored by set_action() release_2.899
authorJon Turney <jon.turney@dronecode.org.uk>
Wed, 1 Jan 2020 14:38:45 +0000 (14:38 +0000)
committerJon Turney <jon.turney@dronecode.org.uk>
Wed, 1 Jan 2020 14:38:45 +0000 (14:38 +0000)
set_action() with action = Install_action and desired = empty version
when curr = empty version is equivalent to action = NoChange_Action.

(This can occur if we are selecting a category for install on the
command line, and that category happens to include a package which only
has a test version, but no current version)

(For completeness, also address the case of action = Install_action,
desired = empty_version, where curr = some version is equivalent to
action = Uninstall_action)

package_meta.cc

index 940f69a6d19910168bd08609756e1b7e160d8467..1f6ab1676f923731bcf4fab7981e6d325979cff8 100644 (file)
@@ -549,30 +549,31 @@ packagemeta::set_action (_actions action, packageversion const &default_version,
   else if (action == Install_action)
     {
       desired = default_version;
-      if (desired)
-       {
-         if (desired != installed)
-           if (desired.accessible ())
-             {
-               /* Memorize the fact that the user picked to install this package at least once. */
-               if (useraction)
-                 user_picked = true;
-
-               pick (true);
-               srcpick (false);
-             }
-           else
-             {
-               pick (false);
-               srcpick (true);
-             }
-         else
-           {
-             action = NoChange_action;
-             pick (false);
-             srcpick (false);
-           }
-       }
+      if (desired != installed)
+        if (desired.accessible ())
+          {
+            /* Memorize the fact that the user picked to install this package at least once. */
+            if (useraction)
+              user_picked = true;
+
+            pick (true);
+            srcpick (false);
+
+            /* Install no version is Uninstall */
+            if (!desired)
+              action = Uninstall_action;
+          }
+        else
+          {
+            pick (false);
+            srcpick (true);
+          }
+      else
+        {
+          action = NoChange_action;
+          pick (false);
+          srcpick (false);
+        }
     }
   else if (action == Reinstall_action)
     {
This page took 0.041122 seconds and 5 git commands to generate.