Skip to content

Fix libraries comparator logic in library manager #9748

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

Merged
merged 1 commit into from
Feb 12, 2020

Conversation

cmaglie
Copy link
Member

@cmaglie cmaglie commented Feb 11, 2020

Previously it could lead to "contract violations", for example consider this:

A = Library{ Name:"A", Types: ["Sensors"] }
B = Library{ Name:"B", Types: null }
C = Library{ Name:"C", Types: ["Arduino"] }

it results in:

A<B (because B has Types==null and compareName("A","B")<0)
B<C (because B has Types==null and compareName("B","C")<0)
C<A (becuase C has Types=="Arduino" and the comparator returns -1 directly)

This commit fix this behavior.

Fix #9738

Previously it could lead to contract violations for example consider
this:

A = Library{ Name:"A", Types: ["Sensors"] }
B = Library{ Name:"B", Types: null        }
C = Library{ Name:"C", Types: ["Arduino"] }

it results in:

A<B (because B has Types==null and compare("A","B")<0)
B<C (because B has Types==null and compare("B","C")<0)
C<A (becuase C has Types=="Arduino" and the comparator returns -1)

This commit fix this behavior
@cmaglie cmaglie added Type: Bug Component: Board/Lib Manager Boards Manager or Library Manager labels Feb 11, 2020
@cmaglie cmaglie added this to the Release 1.8.12 milestone Feb 11, 2020
@cmaglie cmaglie self-assigned this Feb 11, 2020
@cmaglie cmaglie merged commit 8793a6d into arduino:master Feb 12, 2020
@cmaglie cmaglie deleted the fix-libs-comparator-logic branch February 12, 2020 08:54
@cmaglie cmaglie mentioned this pull request Mar 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Board/Lib Manager Boards Manager or Library Manager Type: Bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Arduino 1.8.11 Library Manager: Comparison method violates its original contract.
2 participants