spack/lib
Todd Gamblin a0c7209dc1
bugfix: package hash should affect process, dag, and dunder hashes (#32516)
This fixes a bug where two installations that differ only by package hash will not show
up in `spack find`.

The bug arose because `_cmp_node` on `Spec` didn't include the package hash in its
yielded fields. So, any two `Spec` objects that were only different by package hash
would appear to be equal and would overwrite each other when inserted into the same
`dict`. Note that we could still *install* specs with different package hashes, and they
would appear in the database, but we code that needed to put them into data structures
that use `__hash__` would have issues.

This PR makes `Spec.__hash__` and `Spec.__eq__` include the `process_hash()`, and it
makes `Spec._cmp_node` include the package hash. All of these *should* include all
information in a spec so that we don't end up in a situation where we are blind to
particular field differences.

Eventually, we should unify the `_cmp_*` methods with `to_node_dict` so there aren't two
sources of truth, but this needs some thought, since the `_cmp_*` methods exist for
speed. We should benchmark whether it's really worth having two types of hashing now
that we use `json` instead of `yaml` for spec hashing.

- [x] Add `package_hash` to `Spec._cmp_node`
- [x] Add `package_hash` to `spack.solve.asp.spec_clauses` so that the `package_hash`
      will show up in `spack diff`.
- [x] Add `package_hash` to the `process_hash` (which doesn't affect abstract specs
      but will make concrete specs correct)
- [x] Make `_cmp_iter` report the dag_hash so that no two specs with different
      process hashes will be considered equal.
2022-09-16 00:57:10 +00:00
..
spack bugfix: package hash should affect process, dag, and dunder hashes (#32516) 2022-09-16 00:57:10 +00:00