forked from lix-project/lix
fetchurl/fetchTarball: Respect name changes
The computation of urlHash didn't take the name into account, so subsequent fetchurl calls with the same URL but a different name would resolve to the same cached store path.
This commit is contained in:
parent
f25791c196
commit
66ddbef754
|
@ -1911,7 +1911,7 @@ void fetch(EvalState & state, const Pos & pos, Value * * args, Value & v,
|
|||
{
|
||||
string url;
|
||||
Hash expectedHash;
|
||||
string name;
|
||||
string name = "";
|
||||
|
||||
state.forceValue(*args[0]);
|
||||
|
||||
|
|
|
@ -23,6 +23,8 @@
|
|||
#include <cmath>
|
||||
#include <random>
|
||||
|
||||
using namespace std::string_literals;
|
||||
|
||||
namespace nix {
|
||||
|
||||
double getTime()
|
||||
|
@ -604,7 +606,7 @@ Path Downloader::downloadCached(ref<Store> store, const string & url_, bool unpa
|
|||
Path cacheDir = getCacheDir() + "/nix/tarballs";
|
||||
createDirs(cacheDir);
|
||||
|
||||
string urlHash = hashString(htSHA256, url).to_string(Base32, false);
|
||||
string urlHash = hashString(htSHA256, name + std::string("\0"s) + url).to_string(Base32, false);
|
||||
|
||||
Path dataFile = cacheDir + "/" + urlHash + ".info";
|
||||
Path fileLink = cacheDir + "/" + urlHash + "-file";
|
||||
|
|
Loading…
Reference in a new issue