aboutsummaryrefslogtreecommitdiff
path: root/src/libstore/store-api.cc
diff options
context:
space:
mode:
authoreldritch horrors <pennae@lix.systems>2024-03-04 07:50:02 +0100
committereldritch horrors <pennae@lix.systems>2024-03-04 07:50:02 +0100
commit5f2eaa1b3596d9354f6111d493be208867594352 (patch)
tree092a84a6f3ae05301ff5d6be1a39f746ef353132 /src/libstore/store-api.cc
parentaac8416eac606c1b6253ae78b8b3168c718366bd (diff)
Merge pull request #9662 from shlevy/flat-fixed-references-assert
Improve error message for fixed-outputs with references. (cherry picked from commit ff6de4a9ee6c3862db9ee5f09ff9c3f43ae7a088) Change-Id: I733c49760b9a3f1b76a6bece3b250b8579cd6cac
Diffstat (limited to 'src/libstore/store-api.cc')
-rw-r--r--src/libstore/store-api.cc5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/libstore/store-api.cc b/src/libstore/store-api.cc
index 484a0ca6e..958691256 100644
--- a/src/libstore/store-api.cc
+++ b/src/libstore/store-api.cc
@@ -190,7 +190,10 @@ StorePath Store::makeFixedOutputPath(std::string_view name, const FixedOutputInf
if (info.hash.type == htSHA256 && info.method == FileIngestionMethod::Recursive) {
return makeStorePath(makeType(*this, "source", info.references), info.hash, name);
} else {
- assert(info.references.size() == 0);
+ if (!info.references.empty()) {
+ throw Error("fixed output derivation '%s' is not allowed to refer to other store paths.\nYou may need to use the 'unsafeDiscardReferences' derivation attribute, see the manual for more details.",
+ name);
+ }
return makeStorePath("output:out",
hashString(htSHA256,
"fixed:out:"