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

Re-initializing easyblocks modifies easyconfig input parameter #4289

Open
Micket opened this issue Jun 29, 2023 · 0 comments
Open

Re-initializing easyblocks modifies easyconfig input parameter #4289

Micket opened this issue Jun 29, 2023 · 0 comments
Milestone

Comments

@Micket
Copy link
Contributor

Micket commented Jun 29, 2023

The easyconfig ec parameter gets passed as the first argument to EasyBlock's base init . This gets assigned as self.cfg = ec inside the easyblocks.
However, it's a few easyblocks (cargo, Bundle, and others) then modifies the self.cfg variable, modifying the referenced input argument ec .
This can break things in test suites and in the code as EasyBlock 's get initialized several times throughout the code.
Example: easybuilders/easybuild-easyconfigs#18027 failing at the time of writing this because check_sha256_checksum adds.
Workarounds have also been added in Cargo easyblock which prevents it from adding the crates to the source list repeatedly.

I think it also might be happening outside of just the check_sha256* CI stuff, and it just hasn't caused an issue.

  1. Maybe the base easyblock should get a copy self.cfg = deepcopy(ec) such that the original input argument isn't modified. But I don't know if there are any places where it's assumed that the ec should be modified by the constructor of the easyblocks.
  2. Add a parameter inside ec to detect if it's been initialized already, and add checks to skip that in Bundle. Quite fragile approach, but if this behavior is relied on, then this is still far better than the attempts to "restore" ec by trying to undo what the EasyBlock did (which is basically impossible, since it just guesses what the easyblock did and deletes everything it thinks was added).
  3. Try to fix CI not to repeat the initilization, presumably be preserving the easyblock instance somehow. Very ugly but perhaps the EasyConfig class could store a reference to it, i.e. lazily once init the easyblock?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants