about summary refs log tree commit diff
path: root/tvix
diff options
context:
space:
mode:
authorAdam Joseph <adam@westernsemico.com>2023-09-18T10·47-0700
committerclbot <clbot@tvl.fyi>2023-12-10T14·16+0000
commit2b4920c35582cddf0a8063e7d82d4de2e250732c (patch)
tree1b6dd93a33ffa102c06992c74c1e5708f43d659f /tvix
parentefaff795848a5ab20ded471f63bc02e5d1fb916a (diff)
fix(tvix/cli): panic on root cause of the fetchurl(non-boot) bug r/7142
Currently we produce wrong drvPaths for a large number of packages
that use fetchurl (but not fetchurlBoot, which is what stdenv uses).
A simple reproducer is `pkgs.perl538`.

I debugged this down to the root cause, which is the fact that tvix
doesn't realize that the mapping from FOD-paths to outputHash is
*NOT* a 1:1 mapping.  It is a many-to-one mapping.  You can have
lots of different FODs with the same outputHash or even the same
outPath.  For example, perl538.src and perldevel.src use the same
source tarball but a different `version`.

Anyways, I have found the root cause but have run out of time for a
while, so I've added a panic!() to in the spot where we have a logic
bug in order to call it out.

Change-Id: I9766b39cfe2fe7eafec84945b2ad6cc28f9c4b7d
Reviewed-on: https://cl.tvl.fyi/c/depot/+/9364
Reviewed-by: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
Autosubmit: Adam Joseph <adam@westernsemico.com>
Diffstat (limited to 'tvix')
-rw-r--r--tvix/glue/src/known_paths.rs28
1 files changed, 27 insertions, 1 deletions
diff --git a/tvix/glue/src/known_paths.rs b/tvix/glue/src/known_paths.rs
index 07373ef0da7a..df9f23f3cf6e 100644
--- a/tvix/glue/src/known_paths.rs
+++ b/tvix/glue/src/known_paths.rs
@@ -93,7 +93,33 @@ impl KnownPaths {
                 match (path_kind, &mut entry.get_mut().kind) {
                     // These variant combinations require no "merging action".
                     (PathKind::Plain, PathKind::Plain) => (),
-                    (PathKind::Output { .. }, PathKind::Output { .. }) => (),
+
+                    (
+                        PathKind::Output {
+                            name: name1,
+                            derivation: drv1,
+                        },
+                        PathKind::Output {
+                            name: ref name2,
+                            derivation: ref drv2,
+                        },
+                    ) => {
+                        #[cfg(debug_assertions)]
+                        {
+                            if &name1 != name2 {
+                                panic!(
+                                    "inserted path {} with two different names: {} and {}",
+                                    path, name1, name2
+                                );
+                            }
+                            if &drv1 != drv2 {
+                                panic!(
+                                    "inserted path {} with two different derivations: {} and {}",
+                                    path, drv1, drv2
+                                );
+                            }
+                        }
+                    }
 
                     (
                         PathKind::Derivation { output_names: new },