Skip to content

Original and spliced specs have the same hash #48578

@alalazo

Description

@alalazo

Steps to reproduce

It seems spliced specs have the same hash as the original ones, which is a severe bug affecting many places in Spack, when using spliced specs.

Apply the following diff to code (needed to allow using the mock repository):

diff --git a/lib/spack/spack/solver/asp.py b/lib/spack/spack/solver/asp.py
index cca1ad4262..4de6ed5386 100644
--- a/lib/spack/spack/solver/asp.py
+++ b/lib/spack/spack/solver/asp.py
@@ -3888,11 +3888,11 @@ def _has_runtime_dependencies(spec: spack.spec.Spec) -> bool:
     if not WITH_RUNTIME:
         return True
 
-    if spec.compiler.name == "gcc" and not spec.dependencies("gcc-runtime"):
-        return False
+    #if spec.compiler.name == "gcc" and not spec.dependencies("gcc-runtime"):
+    #    return False
 
-    if spec.compiler.name == "oneapi" and not spec.dependencies("intel-oneapi-runtime"):
-        return False
+    #if spec.compiler.name == "oneapi" and not spec.dependencies("intel-oneapi-runtime"):
+    #    return False
 
     return True
 

Then prepare the stage for the experiment with the following commands:

$ spack -m install --fake "splice-t@1 ^[email protected]+compat ^[email protected]"
$ spack -m install --fake "[email protected]+compat ^[email protected]"

In my case they give:

$ spack find -l
-- linux-ubuntu20.04-icelake / [email protected] -----------------------
wpukznn [email protected]  vnygwbq [email protected]  7pohccu [email protected]  rf7mmyx [email protected]  lh6nq47 [email protected]
==> 5 installed packages

$ spack find -ld /rf7mmyx
-- linux-ubuntu20.04-icelake / [email protected] -----------------------
rf7mmyx [email protected]
wpukznn     [email protected]
vnygwbq     [email protected]
lh6nq47     [email protected]

==> 1 installed package

Note that /rf7mmyx depends on [email protected].

Now try to splice the specs:

$ spack -m -c "concretizer:splice:automatic:true" -c "packages:splice-t:buildable:false" -c "packages:splice-h:buildable:false" spec -l splice-t@1 ^[email protected]+compat
[+]  rf7mmyx  [email protected]%[email protected] build_system=generic arch=linux-ubuntu20.04-icelake
[e]  wpukznn      ^[email protected]%[email protected] build_system=autotools arch=linux-ubuntu20.04-icelake
[+]  7pohccu      ^[email protected]%[email protected]~bar~baz+compat~foo build_system=generic arch=linux-ubuntu20.04-icelake
[+]  lh6nq47      ^[email protected]%[email protected]~bar+compat~foo build_system=generic arch=linux-ubuntu20.04-icelake

The spliced spec depends on [email protected] and has the same hash as before. When trying to install it, Spack thinks everything is already done:

$ spack -m -c "concretizer:splice:automatic:true" -c "packages:splice-t:buildable:false" -c "packages:splice-h:buildable:false" install --fake splice-t@1 ^[email protected]+compat 
[+] /usr (external glibc-2.31-wpukznnzkwjyyfi737w5nnrmyqvxovpt)
[+] /home/culpo/.local/spack/opt/linux-ubuntu20.04-icelake/gcc-10.5.0/splice-z-1.0.0-lh6nq47p2qtz2e7aavagughvttaznwkh
[+] /home/culpo/.local/spack/opt/linux-ubuntu20.04-icelake/gcc-10.5.0/splice-h-1.0.2-7pohccuw632y4l7xglvvwfowkapepjjy
[+] /home/culpo/.local/spack/opt/linux-ubuntu20.04-icelake/gcc-10.5.0/splice-t-1.0-rf7mmyxkxwsfmotbrsk5h4qwdsuryfgy

Error message

No error messages, but splicing is currently unusable since it gives wrong hashes.

Information on your system

  • Spack: 0.24.0.dev0 (f3522cb)
  • Python: 3.13.0
  • Platform: linux-ubuntu20.04-icelake

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

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions