Conversation
|
can you add a regression test to make sure the bug won't re-appear when someone tried to refactor the code next time? |
|
I think that's a good suggestion, but I'm not interested in adding the tests myself. I found and fixed a bug in someone else's code, I would rather not get more involved if I don't have to. I'm also hoping the author of the code will check over my fix, maybe there are other places nearby where the same problem occurs that I missed. |
fair enough. |
|
@citibeth: even a small regression test for the case you describe towards the beginning of the PR would help out other maintainers tremendously. The test could go in tests/config.py but doesn't have to use all the mock configs in there. You could just add a test_aliasing() function that calls merge_yaml with literal arguments known to produce a bad result and asserts the ids aren't the same in the result. |
|
@tgamblin I found a more serious problem merging configurations, I'm looking for your advice on it. The issue is with merging variants:
I'm afraid that configuration merging has not been thought all the way through, at least as far as variants go. Do you have any suggestions / recommendations on finishing the task? For example:
|
|
So for now, my |
|
@tgamblin Given the issues uncovered here, I would recommend that we just consider configuration merging NOT ready for the |
|
I discovered a new bug in the way With the following packages:
all:
variants: -mpiWith the following That's weird. I would've expected the variants to be merged instead of overwritten. |
|
Yes, I discovered that too. You need to write:
packages:
all:
variants: [-mpi]
hdf5:
variants: [+szip,+myvariant]
That is unintuitive, but it works. There are also a whole bunch of
unanswered questions on how this should work. This is why I concluded
that scope-merging is not ready to be promoted as a 0.10.0 feature.
Needs more work...
…On Fri, Jan 20, 2017 at 6:03 PM, Adam J. Stewart ***@***.***> wrote:
I discovered a new bug in the way packages.yaml is parsed. With no
packages.yaml:
$ spack spec hdf5
...
***@***.******@***.***+cxx~debug+fortran+mpi+pic+shared~szip~threadsafe arch=darwin-sierra-x86_64
***@***.******@***.***~java~mxm~pmi~psm~psm2~slurm~sqlite3~thread_multiple~tm~verbs+vt arch=darwin-sierra-x86_64
***@***.******@***.*** arch=darwin-sierra-x86_64
***@***.******@***.*** arch=darwin-sierra-x86_64
***@***.******@***.*** arch=darwin-sierra-x86_64
***@***.******@***.***+sigsegv arch=darwin-sierra-x86_64
***@***.******@***.*** arch=darwin-sierra-x86_64
***@***.******@***.***+internal_glib arch=darwin-sierra-x86_64
***@***.******@***.*** arch=darwin-sierra-x86_64
***@***.******@***.***+pic arch=darwin-sierra-x86_64
With the following packages.yaml:
packages:
all:
variants: -mpi
$ spack spec hdf5
...
***@***.******@***.***+cxx~debug+fortran~mpi+pic+shared~szip~threadsafe arch=darwin-sierra-x86_64
***@***.******@***.***+pic arch=darwin-sierra-x86_64
With the following packages.yaml:
packages:
all:
variants: -mpi
hdf5:
variants: +szip
$ spack spec hdf5
...
***@***.******@***.***+cxx~debug+fortran+mpi+pic+shared+szip~threadsafe arch=darwin-sierra-x86_64
***@***.******@***.***~java~mxm~pmi~psm~psm2~slurm~sqlite3~thread_multiple~tm~verbs+vt arch=darwin-sierra-x86_64
***@***.******@***.*** arch=darwin-sierra-x86_64
***@***.******@***.*** arch=darwin-sierra-x86_64
***@***.******@***.*** arch=darwin-sierra-x86_64
***@***.******@***.***+sigsegv arch=darwin-sierra-x86_64
***@***.******@***.*** arch=darwin-sierra-x86_64
***@***.******@***.***+internal_glib arch=darwin-sierra-x86_64
***@***.******@***.*** arch=darwin-sierra-x86_64
***@***.******@***.*** arch=darwin-sierra-x86_64
***@***.******@***.***+pic arch=darwin-sierra-x86_64
That's weird. I would've expected the variants to be merged instead of
overwritten.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#2694 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AB1cd2FrGdqvMM0wLJsWfYqRSzyl-Utmks5rUT1UgaJpZM4LYd5B>
.
|
|
@citibeth Unfortunately that doesn't work either. On develop, with a packages:
all:
variants: [-mpi]
hdf5:
variants: [+szip]I'm still seeing: |
|
Not surprised. I was only merging positive variants in my lists. I think
this needs more work.
…On Fri, Jan 20, 2017 at 6:19 PM, Adam J. Stewart ***@***.***> wrote:
@citibeth <https://github.com/citibeth> Unfortunately that doesn't work
either. On develop, with a packages.yaml that looks like:
packages:
all:
variants: [-mpi]
hdf5:
variants: [+szip]
I'm still seeing:
$ spack spec hdf5
...
***@***.******@***.***+cxx~debug+fortran+mpi+pic+shared+szip~threadsafe arch=darwin-sierra-x86_64
***@***.******@***.***~java~mxm~pmi~psm~psm2~slurm~sqlite3~thread_multiple~tm~verbs+vt arch=darwin-sierra-x86_64
***@***.******@***.*** arch=darwin-sierra-x86_64
***@***.******@***.*** arch=darwin-sierra-x86_64
***@***.******@***.*** arch=darwin-sierra-x86_64
***@***.******@***.***+sigsegv arch=darwin-sierra-x86_64
***@***.******@***.*** arch=darwin-sierra-x86_64
***@***.******@***.***+internal_glib arch=darwin-sierra-x86_64
***@***.******@***.*** arch=darwin-sierra-x86_64
***@***.******@***.*** arch=darwin-sierra-x86_64
***@***.******@***.***+pic arch=darwin-sierra-x86_64
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#2694 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AB1cd4NNJHNMEe1uvECm4nmD7utRG7xxks5rUUD6gaJpZM4LYd5B>
.
|
|
Fixed in #7959 |
The function
_merge_yaml()was buggy because objects within two separatedicttrees could be aliased together. In my example case, I hadid(dest['packages']['all']['versions']) == id(dest['packages']['ibmisc']['versions'])because both were initially equal to the empty list[]. When_merge_yaml()appended to one list, it appeneded to both --- producing surprising (and wrong) results.@tgamblin Can you please check this PR to see if there are any other places that need a similar fix?
To see the bug in action without this patch, use the following
packages.yamlfiles:Then try
spack config get packages, which yields surprising results:This will cause the
@developversion to be (wrongly) used on any package where it's possible; for example onhypre: