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

Fix to_checksums with None values in dicts and recursion #4579

Open
wants to merge 5 commits into
base: 5.0.x
Choose a base branch
from

Conversation

Flamefire
Copy link
Contributor

@Flamefire Flamefire commented Jul 17, 2024

#4159 rebased to 5.0x

Having a 'src': None entry in a dict for checksums is as valid as having a None entry directly in the list. However the current function didn't handle it and crashed.
Fix that as well as a few corner cases especially in the recursive case by introducing a new function for handling checksum entries in the checksum list and limiting the recursiveness.

It will now throw an EasyBuildError similar to e.g. to_dependency instead of trying to continue and fail at a random other place.
I extended the testcases to cover the original issue (None as a value in a dict) and some more correct and error cases

Please carefully review and check if you can come up with any valid or invalid checksums entry that might break using the new function. Especially regarding the YEB compatibility this was pretty hard as for lists of strings you cannot know if those are 2 checksums without a type that should both match or a checksum and type. In EC-files (Python) one can use a tuple for that but then again it is hard to tell if that tuple is a checksum and type or 2 alternative checksums.

Fixes #4142

The `None` case was missed and due to the unrestricted `tuple` elem_type
it may return valid for actually invalid entries.
So restrict that beeing overly cautious so it may wrongly return invalid.
But in that case the conversion function will be called which can do more
elaborate verification.

Add test checking for None in checksums.
…bility

Not sure if that makes sense but at least for EB 4.x we need this.
Having a `'src': None` entry in a dict for checksums is as valid as
having a `None` entry directly in the list. However the current function
didn't handle it and crashed.
Fix that as well as a few corner cases especially in the recursive case
by introducing a new function for handling checksum entries in the
checksum list and limiting the recursiveness.

Fixes easybuilders#4142
@Flamefire Flamefire force-pushed the fix-to_checksums-5 branch from cc6e27a to fb20fd2 Compare July 17, 2024 10:47
@boegel boegel added bug fix EasyBuild-5.0 EasyBuild 5.0 labels Jul 31, 2024
@boegel boegel changed the title Fix to_checksums with None values in dicts and recursion - 5.0x Fix to_checksums with None values in dicts and recursion Jul 31, 2024
@boegel boegel changed the title Fix to_checksums with None values in dicts and recursion Fix to_checksums with None values in dicts and recursion Jul 31, 2024
@boegel boegel added this to the 5.0 milestone Jul 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants