Prevent tempdir from being GC-ed before addToStoreFromDump has renamed it

This fixes issue 6823 by placing the tempdir used in LocalStore::addToStoreFromDump
outside the Nix store, where automatic GC is no longer a concern.
This commit is contained in:
Andrew Brooks 2022-09-02 18:32:35 -05:00
parent 0c7f213c87
commit 1f041ac54f

View file

@ -1388,7 +1388,7 @@ StorePath LocalStore::addToStoreFromDump(Source & source0, std::string_view name
StringSource dumpSource { dump }; StringSource dumpSource { dump };
ChainSource bothSource { dumpSource, source }; ChainSource bothSource { dumpSource, source };
auto tempDir = createTempDir(realStoreDir, "add"); auto tempDir = createTempDir("", "add");
delTempDir = std::make_unique<AutoDelete>(tempDir); delTempDir = std::make_unique<AutoDelete>(tempDir);
tempPath = tempDir + "/x"; tempPath = tempDir + "/x";