From 84748541c7549904c2c89f2dc413c1fa35ad96b6 Mon Sep 17 00:00:00 2001 From: Puck Meerburg Date: Sun, 11 May 2025 22:21:07 +0000 Subject: [PATCH] (zilch magic): purposely dangle self-references in IA->CA handling This is to workaround an issue I don't know how to fix right now. In effect: Some of the Nix code contains the placeholder for $out, which then gets translated to $out for that store path. Converting that fails, for obvious reasons. However, rewriting those to self-references is more complicated than I want to get into right now, and as the behavior of self-references is vaguely broken (and this only affects one test and a comment), I'm going to take the easy way out and make it generate a dangling reference. --- core/src/magic.sld | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core/src/magic.sld b/core/src/magic.sld index 96ce27c..bd39c97 100644 --- a/core/src/magic.sld +++ b/core/src/magic.sld @@ -59,7 +59,7 @@ ; It turns out these are broken in both Nix and Lix. ; Also, I now don't have to implement the _second_ type of modulo ; hash in Scheme, so that's a win for me. - (error "Refusing to import self-referenced CA path into the store.") + (fprintf (current-error-port) "Path ~S has self-reference, this will dangle!\n" path) (if (null? (cdr self-references)) (set! references-filtered '()) (begin @@ -70,9 +70,9 @@ (set-cdr! self-references (cddr self-references))))) (define name (string-copy path (+ (string-length (%store-dir)) 1 32 1))) - (define ca-store-path (make-fixed-output-with-references hash name references-filtered self-references)) + (define ca-store-path (make-fixed-output-with-references hash name references-filtered #f)) (unless (daemon-wop-query-path-info conn ca-store-path) - (daemon-wop-add-to-store-nar conn ca-store-path (valid-path-info-deriver data) (hex hash) references nar-size (string-append "fixed:r:sha256:" (as-base32 hash)) + (daemon-wop-add-to-store-nar conn ca-store-path (valid-path-info-deriver data) (hex hash) references-filtered nar-size (string-append "fixed:r:sha256:" (as-base32 hash)) (lambda (write-blob) (define new-conn (daemon-connect)) (daemon-wop-nar-from-path new-conn path)