about summary refs log tree commit diff
path: root/src/libstore/download.cc
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2018-02-23T12·00+0100
committerEelco Dolstra <edolstra@gmail.com>2018-02-23T12·00+0100
commit64e486ab63a87b18922bbdb8d2414e74afabb8db (patch)
treefc978f415edd8f8204f4d150994ba5474eb661b2 /src/libstore/download.cc
parent39b4177500e8375554bd2012f6f51f6021c881c1 (diff)
Fix downloadCached() with a chroot store
E.g.

  nix run --store ~/my-nix -f channel:nixos-17.03 hello -c hello

This problem was mentioned in #1897.
Diffstat (limited to 'src/libstore/download.cc')
-rw-r--r--src/libstore/download.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/libstore/download.cc b/src/libstore/download.cc
index 258d7937cc39..5ab625f42288 100644
--- a/src/libstore/download.cc
+++ b/src/libstore/download.cc
@@ -717,7 +717,7 @@ Path Downloader::downloadCached(ref<Store> store, const string & url_, bool unpa
             Path tmpDir = createTempDir();
             AutoDelete autoDelete(tmpDir, true);
             // FIXME: this requires GNU tar for decompression.
-            runProgram("tar", true, {"xf", storePath, "-C", tmpDir, "--strip-components", "1"});
+            runProgram("tar", true, {"xf", store->toRealPath(storePath), "-C", tmpDir, "--strip-components", "1"});
             unpackedStorePath = store->addToStore(name, tmpDir, true, htSHA256, defaultPathFilter, NoRepair);
         }
         replaceSymlink(unpackedStorePath, unpackedLink);
@@ -727,7 +727,7 @@ Path Downloader::downloadCached(ref<Store> store, const string & url_, bool unpa
     if (expectedStorePath != "" && storePath != expectedStorePath)
         throw nix::Error("store path mismatch in file downloaded from '%s'", url);
 
-    return storePath;
+    return store->toRealPath(storePath);
 }