Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clingo error with versions of virtual packages #26718

Closed
3 tasks done
mwkrentel opened this issue Oct 13, 2021 · 3 comments · Fixed by #26740
Closed
3 tasks done

clingo error with versions of virtual packages #26718

mwkrentel opened this issue Oct 13, 2021 · 3 comments · Fixed by #26740
Assignees
Labels
bug Something isn't working impact-medium

Comments

@mwkrentel
Copy link
Member

Steps to reproduce

This is a bug with clingo and versions of virtual packages.

For hpcviewer, old versions require java exactly version 8, new
versions use java >= 11, so we have:

depends_on('java@11:', type=('build', 'run'), when='@2021.0:')
depends_on('java@8', type=('build', 'run'), when='@:2020')

Note that the two when regions are disjoint, so for a given version,
only one can be correct. But with clingo, an old spec
hpcviewer@2019.12 concretizes as:

hpcviewer@2019.12%gcc@8.4.1 arch=linux-rhel8-x86_64
    ^openjdk@11.0.12_7%gcc@8.4.1 arch=linux-rhel8-x86_64

This is incorrect. Version 2019.12 satisfies @:2020 and
should require java 8, so openjdk 1.8.

The problem is with the combination of clingo and java as a virtual
package. The original concretizer correctly picks openjdk@1.8.0_265-b01

Or, if I change depends_on('java') to a concrete package openjdk
(version 1.8), then clingo correctly picks 1.8.0_265-b01.

ping @tgamblin @alalazo @becker33
anyone else ?

Error message

$ spack -d spec hpcviewer@2019.12

spack-spec.txt

Information on your system

$ spack debug report

  • Spack: 0.11.2-14795-81c272fcb7
  • Python: 3.6.8
  • Platform: linux-rhel8-zen2
  • 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
@mwkrentel mwkrentel added bug Something isn't working triage The issue needs to be prioritized labels Oct 13, 2021
@alalazo alalazo self-assigned this Oct 14, 2021
@alalazo alalazo added this to To do in Spack 0.17.0 Release via automation Oct 14, 2021
@alalazo alalazo added impact-medium and removed triage The issue needs to be prioritized labels Oct 14, 2021
@alalazo
Copy link
Member

alalazo commented Oct 14, 2021

Bug confirmed. This is due to the fact that we don't have a "version uniqueness" rule for virtual packages. This diff:

diff --git a/lib/spack/spack/solver/concretize.lp b/lib/spack/spack/solver/concretize.lp
index e444faffec..a05c062071 100644
--- a/lib/spack/spack/solver/concretize.lp
+++ b/lib/spack/spack/solver/concretize.lp
@@ -28,6 +28,8 @@ version_declared(Package, Version) :- version_declared(Package, Version, _).
 1 { version(Package, Version) : version_declared(Package, Version) } 1
  :- node(Package).
 
+:- virtual_node(Package), 2 { version(Package, _) }.
+
 % If we select a deprecated version, mark the package as deprecated
 deprecated(Package, Version) :- version(Package, Version), deprecated_version(Package, Version).

solves the bug for me. Currently checking if any test is failing and trying to add a regression test.

@alalazo
Copy link
Member

alalazo commented Oct 14, 2021

For reference, the current answer set contains 2 versions of java:

version_satisfies("hpcviewer","2019.12") version_satisfies("hpcviewer",":2020") version("hpcviewer","2019.12") virtual_node("java") version_satisfies("java","8") version_satisfies("java","11:") version_satisfies("java","11") version("java","11") version("java","8") version_satisfies("openjdk","11.0:11") version("openjdk","11.0.12_7")

alalazo added a commit to alalazo/spack that referenced this issue Oct 14, 2021
fixes spack#26718

A virtual package may or may not have a version, but it
never has more than one. Previously we were missing a rule
for that.
@alalazo
Copy link
Member

alalazo commented Oct 14, 2021

Hi @mwkrentel thanks for the report! Fix is in #26740 In general if you encounter issues like this one with clingo, feel free to report them on Github and assign to me.

Spack 0.17.0 Release automation moved this from To do to Done Oct 14, 2021
alalazo added a commit that referenced this issue Oct 14, 2021
…es (#26740)

fixes #26718

A virtual package may or may not have a version, but it
never has more than one. Previously we were missing a rule
for that.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working impact-medium
Projects
No open projects
Development

Successfully merging a pull request may close this issue.

2 participants