about summary refs log tree commit diff
path: root/src/libexpr/primops.cc
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2012-07-18T14·47-0400
committerEelco Dolstra <eelco.dolstra@logicblox.com>2012-07-18T14·47-0400
commitfe241ece2932492866693d268d02a7912e766ac7 (patch)
tree2cb24a4d45f563e32946bf34d878969bd05263ec /src/libexpr/primops.cc
parenta6f348599c94d8a5f7b41c7d8e43658dc6407be7 (diff)
parentccc52adfb2121ade510d35dc9b91193af9fa731e (diff)
Merge branch 'master' into no-manifests
Diffstat (limited to 'src/libexpr/primops.cc')
-rw-r--r--src/libexpr/primops.cc6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/libexpr/primops.cc b/src/libexpr/primops.cc
index 354fc39be073..f20c2f2879ab 100644
--- a/src/libexpr/primops.cc
+++ b/src/libexpr/primops.cc
@@ -508,7 +508,11 @@ static void prim_toPath(EvalState & state, Value * * args, Value & v)
 static void prim_storePath(EvalState & state, Value * * args, Value & v)
 {
     PathSet context;
-    Path path = canonPath(state.coerceToPath(*args[0], context));
+    Path path = state.coerceToPath(*args[0], context);
+    /* Resolve symlinks in ‘path’, unless ‘path’ itself is a symlink
+       directly in the store.  The latter condition is necessary so
+       e.g. nix-push does the right thing. */
+    if (!isStorePath(path)) path = canonPath(path, true);
     if (!isInStore(path))
         throw EvalError(format("path `%1%' is not in the Nix store") % path);
     Path path2 = toStorePath(path);