1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-12-02 23:20:59 +01:00

libstore: Use makeTempPath in optimizePath_

This was intended to be cherry-picked in 6aed9d877c,
but was left hanging. This is actually important for fixing [^]. emilazy let me know
of this bad cherry-pick and its significance.

[^]: https://github.com/NixOS/nix/issues/7273

Originally fixed by Lily Ballard <lily@ballards.net> in https://gerrit.lix.systems/c/lix/+/2100.

(cherry picked from commit d888846b68)
This commit is contained in:
Sergei Zimmerman 2025-12-01 02:51:37 +03:00 committed by github-actions[bot]
parent bd0522c15b
commit 6c4dc93d9b

View file

@ -234,7 +234,7 @@ void LocalStore::optimisePath_(
its timestamp back to 0. */
MakeReadOnly makeReadOnly(mustToggle ? dirOfPath : "");
std::filesystem::path tempLink = fmt("%1%/.tmp-link-%2%-%3%", config->realStoreDir, getpid(), rand());
std::filesystem::path tempLink = makeTempPath(config->realStoreDir.get(), ".tmp-link");
try {
std::filesystem::create_hard_link(linkPath, tempLink);