From e1cf791ddd0e27265a163592fd3644ba84805fee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Sun, 21 Sep 2025 18:47:23 +0200 Subject: [PATCH] Revert "publish: Prevent publication of non-substitutable derivation outputs." Fixes guix/guix#2450. This reverts commit b5745a327e8dae21caaf10b59256dc7b16d54588, which introduced discrepancies in how substitutes are served; in particular, narinfos of non-substitutable items would still be served, and likewise for narinfos and nars of dependents of non-substitutable items. --- guix/scripts/publish.scm | 8 ++------ tests/publish.scm | 17 ----------------- 2 files changed, 2 insertions(+), 23 deletions(-) diff --git a/guix/scripts/publish.scm b/guix/scripts/publish.scm index 4bd95180324..7638bcbd0e9 100644 --- a/guix/scripts/publish.scm +++ b/guix/scripts/publish.scm @@ -61,7 +61,6 @@ #:use-module (guix cache) #:use-module (guix ui) #:use-module (guix scripts) - #:use-module (guix derivations) #:use-module ((guix utils) #:select (with-atomic-file-output compressed-file?)) #:use-module ((guix build utils) @@ -694,14 +693,11 @@ requested using POOL." (define* (render-nar store request store-item #:key (compression %no-compression)) "Render archive of the store path corresponding to STORE-ITEM." - (let* ((store-path (string-append %store-directory "/" store-item)) - (derivations (map read-derivation-from-file - (valid-derivers store store-path))) - (substitutable? (every substitutable-derivation? derivations))) + (let ((store-path (string-append %store-directory "/" store-item))) ;; The ISO-8859-1 charset *must* be used otherwise HTTP clients will ;; interpret the byte stream as UTF-8 and arbitrarily change invalid byte ;; sequences. - (if (and substitutable? (valid-path? store store-path)) + (if (valid-path? store store-path) (values `((content-type . (application/x-nix-archive (charset . "ISO-8859-1"))) (x-nar-compression . ,compression)) diff --git a/tests/publish.scm b/tests/publish.scm index c8f66b69cd1..3c80c50d515 100644 --- a/tests/publish.scm +++ b/tests/publish.scm @@ -425,23 +425,6 @@ FileSize: ~a~%" (display "This file is not a valid store item." port))) (response-code (http-get (publish-uri (string-append "/nar/invalid")))))) -(test-equal "non-substitutable derivation" - 404 - (let* ((non-substitutable - (run-with-store %store - (gexp->derivation "non-substitutable" - #~(begin - (mkdir #$output) - (chdir #$output) - (call-with-output-file "foo.txt" - (lambda (port) - (display "bar" port)))) - #:substitutable? #f))) - (item (derivation->output-path non-substitutable))) - (build-derivations %store (list non-substitutable)) - (response-code (http-get (publish-uri - (string-append "/nar/" (basename item))))))) - (test-equal "/file/NAME/sha256/HASH" "Hello, Guix world!" (let* ((data "Hello, Guix world!")