spack: `spack spec` doesn't honor concretizer options in the environment scope

Steps to reproduce

On a clean clone of Spack:

$ spack config --scope user add concretizer:unify:false
$ spack env activate --temp
$ spack add zlib@1.2.13
$ spack add zlib@1.2.12
$ spack config add concretizer:unify:true
$ spack concretize
==> Error: concretization failed for the following reasons:

   1. Cannot select a single "version" for package "zlib"
   2. Cannot satisfy 'zlib@1.2.13'
   3. Cannot satisfy 'zlib@1.2.12'. You could consider setting `concretizer:unify` to `when_possible` or `false` to allow multiple versions of some packages.

$ spack spec
==> Starting concretization pool with 2 processes
==> Warning: using "zlib@1.2.12" which is a deprecated version
==> Environment concretized in 1.04 seconds.
Input spec
--------------------------------
zlib@1.2.13

Concretized
--------------------------------
zlib@1.2.13%gcc@9.4.0+optimize+pic+shared build_system=makefile arch=linux-ubuntu20.04-icelake

Input spec
--------------------------------
zlib@1.2.12

Concretized
--------------------------------
zlib@1.2.12%gcc@9.4.0+optimize+pic+shared build_system=makefile patches=0d38234 arch=linux-ubuntu20.04-icelake

Error message

No error message, but the output of spack spec is wrong (should be the same as the output of spack concretize)

Environment is not using the concretizer:unify option set in the spack.yaml file so that spack spec does not follow the correct concretization path when provided.

_Originally posted by @tldahlgren in https://github.com/spack/spack/issues/35298#issuecomment-1581518885_

Information on your system

  • Spack: 0.21.0.dev0 (d91ec8500f7f8265c023b217bce0c0ca34a81a24)
  • Python: 3.8.10
  • Platform: linux-ubuntu20.04-icelake
  • Concretizer: clingo

General information

  • I have run spack debug report and reported the version of Spack/Python/Platform
  • I have searched the issues of this repo and believe this is not a duplicate
  • I have run the failing commands in debug mode and reported the output

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 15 (15 by maintainers)

Most upvoted comments

Done editing 🙂

Thanks, so the bug is with spack spec. What I was asking was something like:

Ah. I understand now.

Would you mind if we add this reproducer to the description above, and change the title to:

   `spack spec` doesn't honor concretizer options in the environment scope 

or something like that (definitely less alarming than the initial bug report)?

Not at all. My head was on the problem I was helping someone else debug with when I wrote the issue and fix.