[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
333/376: builtins.readFile: realise context associated with the path
From: |
Ludovic Courtès |
Subject: |
333/376: builtins.readFile: realise context associated with the path |
Date: |
Wed, 28 Jan 2015 22:05:59 +0000 |
civodul pushed a commit to tag 1.8
in repository guix.
commit 50c33528112d26c0701ce23d435faedb89987b96
Author: Shea Levy <address@hidden>
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());
}
- 321/376: Remove some platforms with too-old compilers, (continued)
- 321/376: Remove some platforms with too-old compilers, Ludovic Courtès, 2015/01/28
- 323/376: Explicitly include required C headers, Ludovic Courtès, 2015/01/28
- 316/376: Merge pull request #401 from shlevy/external-value, Ludovic Courtès, 2015/01/28
- 314/376: Allow external code using libnixexpr to add types, Ludovic Courtès, 2015/01/28
- 328/376: Provide some fallback defaults for the CA bundle, Ludovic Courtès, 2015/01/28
- 329/376: Add option to disable binary cache certificate checking, Ludovic Courtès, 2015/01/28
- 330/376: Doh, Ludovic Courtès, 2015/01/28
- 327/376: Use https://cache.nixos.org instead of http://cache.nixos.org, Ludovic Courtès, 2015/01/28
- 331/376: Fix bad comment, Ludovic Courtès, 2015/01/28
- 320/376: Define ‘environ’, Ludovic Courtès, 2015/01/28
- 333/376: builtins.readFile: realise context associated with the path,
Ludovic Courtès <=
- 332/376: Always use https to fetch the Nixpkgs channel, Ludovic Courtès, 2015/01/28
- 326/376: Link against perl.dll on Cygwin, Ludovic Courtès, 2015/01/28
- 324/376: Set custom compiler flags on Cygwin, Ludovic Courtès, 2015/01/28
- 325/376: Fix library handling on Cygwin, Ludovic Courtès, 2015/01/28
- 335/376: Don't use RPATH on Darwin, Ludovic Courtès, 2015/01/28
- 337/376: Revert "Use posix_spawn to run the pager", Ludovic Courtès, 2015/01/28
- 334/376: Update signing.txt, Ludovic Courtès, 2015/01/28
- 336/376: Cruft, Ludovic Courtès, 2015/01/28
- 339/376: Include cacert in the binary tarball, Ludovic Courtès, 2015/01/28
- 340/376: Rename function, Ludovic Courtès, 2015/01/28