diff options
author | Eelco Dolstra <e.dolstra@tudelft.nl> | 2006-10-10T21·23+0000 |
---|---|---|
committer | Eelco Dolstra <e.dolstra@tudelft.nl> | 2006-10-10T21·23+0000 |
commit | 0c4c5c2020383db9c2d39d7a3420195568d06312 (patch) | |
tree | 5a21b8fd92e06a6b2d2f8a56926c27a69d5337ed /src/libexpr/eval.cc | |
parent | bd0c40e1e93d2239b44bd1f73c2587cd62e66e4d (diff) |
* Quick hack to fix NIX-67: evaluation result differing if the Nix
expression resides in the store.
Diffstat (limited to 'src/libexpr/eval.cc')
-rw-r--r-- | src/libexpr/eval.cc | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/libexpr/eval.cc b/src/libexpr/eval.cc index fa843b5d3b15..2d54f1fc2325 100644 --- a/src/libexpr/eval.cc +++ b/src/libexpr/eval.cc @@ -244,9 +244,11 @@ string coerceToStringWithContext(EvalState & state, e = evalExpr(state, e); + bool isWrapped = false; ATermList es; ATerm e2; if (matchContext(e, es, e2)) { + isWrapped = true; e = e2; context = ATconcat(es, context); } @@ -258,7 +260,7 @@ string coerceToStringWithContext(EvalState & state, if (matchPath(e, s)) { isPath = true; Path path = aterm2String(s); - if (isInStore(path)) { + if (isInStore(path) && !isWrapped) { context = ATinsert(context, makePath(toATerm(toStorePath(path)))); } return path; @@ -295,16 +297,18 @@ static ATerm concatStrings(EvalState & state, const ATermVector & args) std::ostringstream s; bool isPath = false; + /* Note that if the first argument in the concatenation is a path, + then the result is also a path. */ + for (ATermVector::const_iterator i = args.begin(); i != args.end(); ++i) { bool isPath2; s << coerceToStringWithContext(state, context, *i, isPath2); if (i == args.begin()) isPath = isPath2; } - Expr result = isPath + return wrapInContext(context, isPath ? makePath(toATerm(canonPath(s.str()))) - : makeStr(toATerm(s.str())); - return wrapInContext(context, result); + : makeStr(toATerm(s.str()))); } |