civodul pushed a commit to tag 1.8
in repository guix.
commit 50c33528112d26c0701ce23d435faedb89987b96
Author: Shea Levy <[email protected]>
Date: Tue Dec 9 08:21:36 2014 -0500
builtins.readFile: realise context associated with the path
---
src/libexpr/primops.cc | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/libexpr/primops.cc b/src/libexpr/primops.cc
index e7b7960..1ddeac6 100644
--- a/src/libexpr/primops.cc
+++ b/src/libexpr/primops.cc
@@ -756,8 +756,12 @@ static void prim_readFile(EvalState & state, const Pos &
pos, Value * * args, Va
{
PathSet context;
Path path = state.coerceToPath(pos, *args[0], context);
- if (!context.empty())
- throw EvalError(format("string ‘%1%’ cannot refer to other paths, at
%2%") % path % pos);
+ try {
+ realiseContext(context);
+ } catch (InvalidPathError & e) {
+ throw EvalError(format("cannot read ‘%1%’, since path ‘%2%’ is not
valid, at %3%")
+ % path % e.path % pos);
+ }
mkString(v, readFile(path).c_str());
}