aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/libexpr/primops/fetchGit.cc2
-rw-r--r--src/libexpr/primops/fetchMercurial.cc2
-rw-r--r--src/libstore/download.cc2
-rw-r--r--src/libstore/download.hh3
4 files changed, 7 insertions, 2 deletions
diff --git a/src/libexpr/primops/fetchGit.cc b/src/libexpr/primops/fetchGit.cc
index aaf02c856..cf7ccca41 100644
--- a/src/libexpr/primops/fetchGit.cc
+++ b/src/libexpr/primops/fetchGit.cc
@@ -235,7 +235,7 @@ static void prim_fetchGit(EvalState & state, const Pos & pos, Value * * args, Va
v.attrs->sort();
if (state.allowedPaths)
- state.allowedPaths->insert(gitInfo.storePath);
+ state.allowedPaths->insert(state.store->toRealPath(gitInfo.storePath));
}
static RegisterPrimOp r("fetchGit", 1, prim_fetchGit);
diff --git a/src/libexpr/primops/fetchMercurial.cc b/src/libexpr/primops/fetchMercurial.cc
index 66f49f374..d576138f5 100644
--- a/src/libexpr/primops/fetchMercurial.cc
+++ b/src/libexpr/primops/fetchMercurial.cc
@@ -214,7 +214,7 @@ static void prim_fetchMercurial(EvalState & state, const Pos & pos, Value * * ar
v.attrs->sort();
if (state.allowedPaths)
- state.allowedPaths->insert(hgInfo.storePath);
+ state.allowedPaths->insert(state.store->toRealPath(hgInfo.storePath));
}
static RegisterPrimOp r("fetchMercurial", 1, prim_fetchMercurial);
diff --git a/src/libstore/download.cc b/src/libstore/download.cc
index cb77cdc77..975cfd97d 100644
--- a/src/libstore/download.cc
+++ b/src/libstore/download.cc
@@ -804,6 +804,7 @@ CachedDownloadResult Downloader::downloadCached(ref<Store> store, const string &
expectedStorePath = store->makeFixedOutputPath(unpack, expectedHash, name);
if (store->isValidPath(expectedStorePath)) {
CachedDownloadResult result;
+ result.storePath = expectedStorePath;
result.path = store->toRealPath(expectedStorePath);
return result;
}
@@ -912,6 +913,7 @@ CachedDownloadResult Downloader::downloadCached(ref<Store> store, const string &
url, expectedHash.to_string(), gotHash.to_string());
}
+ result.storePath = storePath;
result.path = store->toRealPath(storePath);
return result;
}
diff --git a/src/libstore/download.hh b/src/libstore/download.hh
index 8acfe4e1a..aa8c34be2 100644
--- a/src/libstore/download.hh
+++ b/src/libstore/download.hh
@@ -43,6 +43,9 @@ struct DownloadResult
struct CachedDownloadResult
{
+ // Note: 'storePath' may be different from 'path' when using a
+ // chroot store.
+ Path storePath;
Path path;
std::optional<std::string> etag;
};