-
-
Notifications
You must be signed in to change notification settings - Fork 348
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Compare RelationshipDescriptors with Equals instead of Same #2735
Conversation
What do you need from me and how do I acquire such logs? |
The first thing that would be helpful is a copy of your |
BackgroundCKAN Version: 1.26.0 KSP Version: 1.6.1.2401 Operating System: Windows 10 64bit Have you made any manual changes to your GameData folder (i.e., not via CKAN)? Yes, to install mods that are not listed on CKAN. ProblemWhat steps did you take in CKAN? Opening CKAN for the first time each boot cycle. What did you expect to happen? CKAN opens and automatically updates the repository list. What happened instead? CKAN loads and hangs with a pop-up appearing stating that a mod has had its metadata changed since the last update and recommends reinstalling it the preserve consistency. If you click Yes or No in the pop-up, CKAN then takes the respective action, updates the repository list and loads into the mod listing screen as per expectations. Screenshots: See above CKAN error codes (if applicable): No error codes Registry.json: https://www.dropbox.com/s/3icb9v3lms8q9e1/registry.json?dl=0 |
Thanks! Taking a look, the available module exactly matches the installed module, so that rules out a metadata quirk. Maybe a platform thing; could be that This test build has the fix from this pull request, if you wouldn't mind trying it out and reporting whether the problem is fixed:
|
Testing the above build, CKAN hangs with most of the UI missing for about 5 seconds upon initial application opening then it kicks into gear and starts automatically updating the repo and then loads into the mod list. The change seems to have resolved my issue and I have hard-cycled the PC 5 times to test and all 5 times CKAN booted into the mod list without showing the pop-up. |
I don't know whether it is related, but trying to launch CKAN today just opens the initial console window, it closes after a second or so, then nothing else launches. Hovering over the window preview in the taskbar just shows a blank white preview of the CKAN window but it never opens. I tried downgrading the executable to the 1.26.0 release but the same issue is occuring. Could there be any possible relation? |
Sounds like you encountered #2717 ? |
Yep, exactly that, thanks for the heads up and sorry for the false alarm. Weird bug though. |
Problem
@Poodmund reported an issue on the forum where this popup appears every time CKAN is launched, even after you click Yes to reinstall:
https://forum.kerbalspaceprogram.com/index.php?/topic/154922-ckan-the-comprehensive-kerbal-archive-network-v1260-baikonur/&do=findComment&comment=3586115
Cause
At the top level,
Repo.RelationshipsAreEquivalent
usesRelationshipDescriptor.Same
to compare the relationships of an installed module with those of its freshly updated available counterpart:CKAN/Core/Net/Repo.cs
Lines 321 to 330 in 5331bf9
Child class
ModuleRelationshipDescriptor
implementsSame
as a comparison of the name and versions:CKAN/Core/Types/CkanModule.cs
Lines 152 to 160 in 5331bf9
Child class
AnyOfRelationshipDescriptor
implementsSame
by comparing the lists contained in theany_of
property usingSequenceEqual
:CKAN/Core/Types/CkanModule.cs
Lines 239 to 244 in 5331bf9
However, when
SequenceEqual
checks the pairs of values in the two lists, it usesEquals
, notSame
! This means the nested relationships aren't compared the same way as regular ones, so they might not produce the correct result. This causes CKAN to think anany_of
relationship has changed when it hasn't, and mistakenly alert @Poodmund to it.Changes
Now
RelationshipDescriptor
implementsIEquatable<RelationshipDescriptor>
, and it and its child classes implementEquals
instead ofSame
, with the same logic as before. Calling code is updated to useEquals
instead. This will ensure that the intended comparison logic is used when we callSequenceEqual
.Fixes @Poodmund's issue.