From 58ff6939f4713063dabd77d485689691a82dbb3b Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 17 Oct 2006 12:58:42 +0000 Subject: [PATCH] * An awful backwards compatibility hack. --- src/libexpr/eval.cc | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/libexpr/eval.cc b/src/libexpr/eval.cc index df8be08c6..31e9c462f 100644 --- a/src/libexpr/eval.cc +++ b/src/libexpr/eval.cc @@ -557,6 +557,30 @@ Expr evalExpr2(EvalState & state, Expr e) if (matchOpPlus(e, e1, e2) || matchConcatStrings(e, es)) { ATermVector args; if (matchOpPlus(e, e1, e2)) { + + /* !!! Awful compatibility hack for `drv + /path'. + According to regular concatenation, /path should be + copied to the store and its store path should be + appended to the string. However, in Nix <= 0.10, /path + was concatenated. So handle that case separately, but + do print out a warning. This code can go in Nix 0.12, + maybe. */ + e1 = evalExpr(state, e1); + e2 = evalExpr(state, e2); + + ATermList as; + ATerm p; + if (matchAttrs(e1, as) && matchPath(e2, p)) { + static bool haveWarned = false; + warnOnce(haveWarned, + "concatenation of a derivation and a path is deprecated, " + "you should write `drv + \"/path\"' instead of `drv + /path'"); + PathSet context; + return makeStr( + coerceToString(state, makeSelect(e1, toATerm("outPath")), context) + + aterm2String(p), context); + } + args.push_back(e1); args.push_back(e2); } else