aboutsummaryrefslogtreecommitdiff
path: root/src/libexpr/primops.cc
diff options
context:
space:
mode:
authorAlexander Bantyev <balsoft@balsoft.ru>2021-10-23 21:31:46 +0300
committerAlexander Bantyev <balsoft@balsoft.ru>2021-11-05 22:41:30 +0300
commit9d4dcff37a14c5bab98761e417a2335a9ac68c96 (patch)
tree2eb543ff6fc54a0847b5f0ad3d60f224dc959b16 /src/libexpr/primops.cc
parentb9234142f5e3c69f3372f15ab2e6df19c7bf6b64 (diff)
addPath: allow paths with references
Since 4806f2f6b0fd2cae401b89fe19d8c528ffd88b5f, we can't have paths with references passed to builtins.{path,filterSource}. This prevents many cases of those functions called on IFD outputs from working. Resolve this by passing the references found in the original path to the added path.
Diffstat (limited to 'src/libexpr/primops.cc')
-rw-r--r--src/libexpr/primops.cc10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/libexpr/primops.cc b/src/libexpr/primops.cc
index 4e0eda7f3..4a615c59d 100644
--- a/src/libexpr/primops.cc
+++ b/src/libexpr/primops.cc
@@ -1859,12 +1859,12 @@ static void addPath(
// be rewritten to the actual output).
state.realiseContext(context);
+ StorePathSet refs = StorePathSet();
+
if (state.store->isInStore(path)) {
auto [storePath, subPath] = state.store->toStorePath(path);
- auto info = state.store->queryPathInfo(storePath);
- if (!info->references.empty())
- throw EvalError("store path '%s' is not allowed to have references",
- state.store->printStorePath(storePath));
+ // FIXME: we should scanForReferences on the path before adding it
+ refs = state.store->queryPathInfo(storePath)->references;
path = state.store->toRealPath(storePath) + subPath;
}
@@ -1904,7 +1904,7 @@ static void addPath(
if (!expectedHash || !state.store->isValidPath(*expectedStorePath)) {
dstPath = state.store->printStorePath(settings.readOnlyMode
? state.store->computeStorePathForPath(name, path, method, htSHA256, filter).first
- : state.store->addToStore(name, path, method, htSHA256, filter, state.repair));
+ : state.store->addToStore(name, path, method, htSHA256, filter, state.repair, refs));
if (expectedHash && expectedStorePath != state.store->parseStorePath(dstPath))
throw Error("store path mismatch in (possibly filtered) path added from '%s'", path);
} else