Conversation
copy.copy() was not doing a correct deep copy of syaml_dict.
| for sk, sv in iteritems(source): | ||
| if override(sk) or sk not in dest: | ||
| # if sk ended with ::, or if it's new, completely override | ||
| dest[sk] = copy.copy(sv) |
There was a problem hiding this comment.
I didn't check the logic change that this PR brings, but if we need a deep copy, why aren't we using copy.deepcopy?
|
Because I didn't know it existed. Let me try that, I'll report back...
…On Thu, Apr 26, 2018 at 3:15 PM, Massimiliano Culpo < ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In lib/spack/spack/config.py:
> @@ -363,15 +375,15 @@ def they_are(t):
for sk, sv in iteritems(source):
if override(sk) or sk not in dest:
# if sk ended with ::, or if it's new, completely override
- dest[sk] = copy.copy(sv)
I didn't check the logic, but if we need a deep copy, why aren't we using
copy.deepcopy?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#7925 (review)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AB1cdwpWhUhYogtPjIBftvXAWDMrLetNks5tshzQgaJpZM4Tm-uY>
.
|
Replace homegrown deepcopy with standard `copy.deepcopy()`, which works just as well.
Add back `import copy`
|
@alalazo @tgamblin OK this PR is ready to merge, and it fixes a serious config bug that affects concretization. With bugfix: This is correct. In my various config scopes, I have specified the This is wrong... I get |
|
b6878b7 appears to copy this but doesnt remove Also, a unit test would be excellent so this doesn't happen again in 6 months. Let me know if you'd like me to do that and I can give it a go; in that case more context for the problem - e.g. the conflicting config files - would be excellent. |
Huh? Looks to me like it removes |
I really appreciate your willingness to write a unit test. Here are the basics, not sure the best way to turn that into a unit test. I'm using a Spack Enviroment with the following See attached for develop-packages.yaml.txt Next, I added the following debug printout to With this PR merged, when I run anything (say When I run without the PR merged, I get this incorrect result: There is no simple test for this issue because it's an aliasing problem (eg: memory corruption). |
|
Replaced by #7959 |
@tgamblin Can this be fast-tracked? It is a small change, and fixes a definite bug #7924. Previously, copy.copy() was not doing a correct deep copy of syaml_dict.