summaryrefslogtreecommitdiff
path: root/COPYRIGHT
diff options
context:
space:
mode:
authorTodd Gamblin <tgamblin@llnl.gov>2020-01-21 23:36:10 -0800
committerTodd Gamblin <tgamblin@llnl.gov>2020-02-07 16:11:06 -0600
commitb442b21751634ff771d7dab990683ee3556d5c86 (patch)
tree4f45234a3e8e5f45de9cbf74cb8d1bf96b9fa664 /COPYRIGHT
parent55d5b435c8061d9fdc51feb03bf291b0b7a0f24c (diff)
downloadspack-b442b21751634ff771d7dab990683ee3556d5c86.tar.gz
spack-b442b21751634ff771d7dab990683ee3556d5c86.tar.bz2
spack-b442b21751634ff771d7dab990683ee3556d5c86.tar.xz
spack-b442b21751634ff771d7dab990683ee3556d5c86.zip
bugfix: hashes should use ordered dictionaries (#14390)
Despite trying very hard to keep dicts out of our hash algorithm, we seem to still accidentally add them in ways that the tests can't catch. This can cause errors when hashes are not computed deterministically. This fixes an error we saw with Python 3.5, where dictionary iteration order is random. In this instance, we saw a bug when reading Spack environment lockfiles -- The load would fail like this: ``` ... File "/sw/spack/lib/spack/spack/environment.py", line 1249, in concretized_specs yield (s, self.specs_by_hash[h]) KeyError: 'qcttqplkwgxzjlycbs4rfxxladnt423p' ``` This was because the hashes differed depending on whether we wrote `path` or `module` first when recomputing the build hash as part of reading a Spack lockfile. We can fix it by ensuring a determistic iteration order. - [x] Fix two places (one that caused an issue, and one that did not... yet) where our to_node_dict-like methods were using regular python dicts. - [x] Also add a check that statically analyzes our to_node_dict functions and flags any that use Python dicts. The test found the two errors fixed here, specifically: ``` E AssertionError: assert [] == ['Use syaml_dict instead of ...pack/spack/spec.py:1495:28'] E Right contains more items, first extra item: 'Use syaml_dict instead of dict at /Users/gamblin2/src/spack/lib/spack/spack/spec.py:1495:28' E Full diff: E - [] E + ['Use syaml_dict instead of dict at ' E + '/Users/gamblin2/src/spack/lib/spack/spack/spec.py:1495:28'] ``` and ``` E AssertionError: assert [] == ['Use syaml_dict instead of ...ack/architecture.py:359:15'] E Right contains more items, first extra item: 'Use syaml_dict instead of dict at /Users/gamblin2/src/spack/lib/spack/spack/architecture.py:359:15' E Full diff: E - [] E + ['Use syaml_dict instead of dict at ' E + '/Users/gamblin2/src/spack/lib/spack/spack/architecture.py:359:15'] ```
Diffstat (limited to 'COPYRIGHT')
0 files changed, 0 insertions, 0 deletions