Skip to content
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

%delta is not a linear "linked list" #3

Closed
perlancar opened this issue May 6, 2015 · 1 comment
Closed

%delta is not a linear "linked list" #3

perlancar opened this issue May 6, 2015 · 1 comment
Labels

Comments

@perlancar
Copy link
Owner

Bummer, turns out that due to multiple branches of perl (e.g. even minor version for stable branch and odd for development branch), we cannot simply iterate %delta by sorted key (release version). For example, $delta{'5.017'} is data against 5.016, not against the latest 5.016 release (5.016003).

Because Module::CoreList::More's functions iterate %delta in a single pass (wrongly assuming it was a linear "linked list") they can give wrong result, for example:

Module::CoreList->is_core("Module::CoreList", 2.76, 5.017) # returns false

but

Module::CoreList::More->is_core("Module::CoreList", 2.76, 5.017) # returns true, which is wrong

This is because, Module::CoreList was updated to 2.76 in perl 5.01602. Meanwhile, perl 5.17 still contains Module::CoreList 2.67. Because Module::CoreList::More iterates %delta by release version, it processes 5.017 after 5.01602 and 5.01603. When it should've processed 5.017 after 5.016.

To keep the performance advantage, one solution for this is, I think, is to create another data structure, e.g. %delta_sorted_by_release which contains the delta data sorted by release version. So we can still iterate the structure in a single pass. Also, if we do this, another optimization (early loop exit) also cannot be done because the assumption that module version monotonically increases as release version increases no longer holds (or to be exact, never holds anyway).

@perlancar perlancar added the bug label May 6, 2015
@perlancar
Copy link
Owner Author

Fixed by 323bd90

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant