nix-copy-closure: Fix assertion failure

$ ./inst/bin/nix-copy-closure --to bla $(type -p firefox)
  nix-copy-closure: src/libstore/store-api.cc:80: std::__cxx11::string nix::storePathToHash(const Path&): Assertion `base.size() >= storePathHashLen' failed.
This commit is contained in:
Eelco Dolstra 2017-03-16 10:45:45 +01:00
parent 3f35612c04
commit 43f158bb08
No known key found for this signature in database
GPG key ID: 8170B4726D7198DE

View file

@ -51,8 +51,12 @@ int main(int argc, char ** argv)
auto to = toMode ? openStore(remoteUri) : openStore();
auto from = toMode ? openStore() : openStore(remoteUri);
PathSet storePaths2;
for (auto & path : storePaths)
storePaths2.insert(from->followLinksToStorePath(path));
PathSet closure;
from->computeFSClosure(storePaths, closure, false, includeOutputs);
from->computeFSClosure(storePaths2, closure, false, includeOutputs);
copyPaths(from, to, Paths(closure.begin(), closure.end()), useSubstitutes);
});