Fix infinite recursion when computing concretization errors (#41061)

This commit is contained in:
Massimiliano Culpo 2023-11-14 14:44:58 +01:00 committed by GitHub
parent 18ebef60aa
commit 1255620a14
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -713,7 +713,7 @@ def _get_cause_tree(
(condition_id, set_id) in which the latter idea means that the condition represented by (condition_id, set_id) in which the latter idea means that the condition represented by
the former held in the condition set represented by the latter. the former held in the condition set represented by the latter.
""" """
seen = set(seen) | set(cause) seen.add(cause)
parents = [c for e, c in condition_causes if e == cause and c not in seen] parents = [c for e, c in condition_causes if e == cause and c not in seen]
local = "required because %s " % conditions[cause[0]] local = "required because %s " % conditions[cause[0]]
@ -812,7 +812,14 @@ def on_model(model):
errors = sorted( errors = sorted(
[(int(priority), msg, args) for priority, msg, *args in error_args], reverse=True [(int(priority), msg, args) for priority, msg, *args in error_args], reverse=True
) )
msg = self.message(errors) try:
msg = self.message(errors)
except Exception as e:
msg = (
f"unexpected error during concretization [{str(e)}]. "
f"Please report a bug at https://github.com/spack/spack/issues"
)
raise spack.error.SpackError(msg)
raise UnsatisfiableSpecError(msg) raise UnsatisfiableSpecError(msg)