Skip to content

solver: mutate deepcopied packages config#51355

Merged
haampie merged 1 commit intodevelopfrom
hs/fix/deepcopy-packages-cfg
Sep 24, 2025
Merged

solver: mutate deepcopied packages config#51355
haampie merged 1 commit intodevelopfrom
hs/fix/deepcopy-packages-cfg

Conversation

@haampie
Copy link
Copy Markdown
Member

@haampie haampie commented Sep 24, 2025

closes #51350.

Fixes a bug where shallow-copied packages.yaml config was mutated as part of the solve, causing duplicate entries for glibc in the solver, leading to a multiple unique solutions ultimately mapping to the same concrete spec. This just means that the solver has to spend more time proving optimality.

  • Add spack.util.spack_yaml.deepcopy_as_builtin which takes ruamel.yaml objects and spits out a deep copy using native types dict, list, int, float, bool and type(None).
  • Add spack.config.Configuration.deepcopy_as_builtin, which is like get_config, except it is a deep copy with native types.
  • Use this in spack.solver.runtimes.external_config_with_implicit_externals (which was renamed from _*).

I think in the future the solver can just call deepcopy_as_builtin and work with ordinary dicts, instead of all these inefficient subtypes of strings etc produced by ruamel.yaml.

@haampie haampie requested a review from Copilot September 24, 2025 10:05

This comment was marked as spam.

@haampie haampie merged commit 0326943 into develop Sep 24, 2025
33 checks passed
@haampie haampie deleted the hs/fix/deepcopy-packages-cfg branch September 24, 2025 11:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants