public inbox for cygwin-apps@cygwin.com
 help / color / mirror / Atom feed
From: Christian Franke <Christian.Franke@t-online.de>
To: Jon Turney <jon.turney@dronecode.org.uk>,
	"cygwin-apps@cygwin.com" <cygwin-apps@cygwin.com>
Subject: Re: [Bug] setup regression
Date: Tue, 27 Sep 2022 15:51:11 +0200	[thread overview]
Message-ID: <4d751290-09dd-b9c5-fcd1-aaf09b1aba89@t-online.de> (raw)
In-Reply-To: <835077d9-a870-fb4d-68dc-820d0838d1bb@t-online.de>

[-- Attachment #1: Type: text/plain, Size: 898 bytes --]

Christian Franke wrote:
> ...
> I made the false assumption that default_version=empty in set_action() 
> always implies that the default version is not accessible. This is not 
> the case for packages selected for installation before chooser is 
> visible.
>
> I'm working on a new fix for the "Ctrl+I pressed but current version 
> is not accessible" case. ...

See attached patch. It also fixes the same problem for the "Category" 
view. Testing shows that the problem only affects the display of the 
version number as the solver later silently removes such install requests.


> The correct logic is already in toggle_action(): Install the most 
> recent accessible non-test ('naively_preferred') version.
>

I dropped this idea and aligned Ctrl+I behavior with "Install" from 
"Category" view instead. Toggle_action() behaves different in such 
corner cases as it always installs something.


[-- Attachment #2: 0001-Ignore-install-requests-if-version-is-not-accessible.patch --]
[-- Type: text/plain, Size: 1635 bytes --]

From 7e1efd346e35898e3486fb84cf25b3885a2a16ec Mon Sep 17 00:00:00 2001
From: Christian Franke <christian.franke@t-online.de>
Date: Tue, 27 Sep 2022 15:41:06 +0200
Subject: [PATCH] Ignore install requests if version is not accessible

This avoids that an empty "New" version is shown when install is
requested via "Install" from "Category" view or Ctrl+I and the
version is not accessible.
---
 package_meta.cc | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/package_meta.cc b/package_meta.cc
index 05b8946..ebfc947 100644
--- a/package_meta.cc
+++ b/package_meta.cc
@@ -539,6 +539,17 @@ packagemeta::select_action (int id, trusts const deftrust)
     {
       if (id == packagemeta::NoChange_action)
         set_action((packagemeta::_actions)id, installed);
+      else if (id == Install_action)
+	{
+	  // Ignore install request if the default version is not accessible.
+	  // This assumes that all available versions are already known.
+	  // This is not always the case when set_action is called directly.
+	  packageversion v = trustp (true, deftrust);
+	  if (v.accessible ())
+	    set_action(Install_action, v, true);
+	  else
+	    set_action(NoChange_action, installed);
+	}
       else
         set_action((packagemeta::_actions)id, trustp (true, deftrust), true);
     }
@@ -627,6 +638,7 @@ packagemeta::set_action (_actions action, packageversion const &default_version,
   else if (action == Install_action)
     {
       desired = default_version;
+      // If desired is empty, it will be set to the solver's preferred version later.
       if (desired)
 	{
 	  if (desired != installed)
-- 
2.37.2


  reply	other threads:[~2022-09-27 13:51 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-21 17:38 Achim Gratz
2022-09-21 18:00 ` Achim Gratz
2022-09-22 16:56   ` Achim Gratz
2022-09-23 14:45     ` Jon Turney
2022-09-26 15:14       ` Christian Franke
2022-09-27 13:51         ` Christian Franke [this message]
2022-10-01 15:28           ` Jon Turney
2022-10-03 19:15             ` Achim Gratz
2022-10-05 18:40               ` Achim Gratz
2022-10-04 11:50             ` Christian Franke

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=4d751290-09dd-b9c5-fcd1-aaf09b1aba89@t-online.de \
    --to=christian.franke@t-online.de \
    --cc=cygwin-apps@cygwin.com \
    --cc=jon.turney@dronecode.org.uk \
    /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).