From 451c223deea17918454ae083dcfc0ea2b6103cab Mon Sep 17 00:00:00 2001 From: Shea Levy Date: Tue, 10 Jan 2017 12:22:22 -0500 Subject: [PATCH] builtins.readFile: Put the references of the file, not those needed to realize the file, into the context --- src/libexpr/primops.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/libexpr/primops.cc b/src/libexpr/primops.cc index 4398cc951..5be61c647 100644 --- a/src/libexpr/primops.cc +++ b/src/libexpr/primops.cc @@ -779,6 +779,9 @@ static void prim_readFile(EvalState & state, const Pos & pos, Value * * args, Va string s = readFile(state.checkSourcePath(path)); if (s.find((char) 0) != string::npos) throw Error(format("the contents of the file ‘%1%’ cannot be represented as a Nix string") % path); + context = state.store->isInStore(path) ? + state.store->queryPathInfo(state.store->toStorePath(path))->references : + PathSet{}; mkString(v, s.c_str(), context); }