mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-23 06:26:15 +02:00
* nix-env --switch-generation / --list-generations /
--delete-generations: lock the profile to prevent (extremely unlikely) race conditions.
This commit is contained in:
parent
5c38c863bd
commit
86cbd93ec1
1 changed files with 9 additions and 0 deletions
|
@ -943,6 +943,9 @@ static const int prevGen = -2;
|
||||||
|
|
||||||
static void switchGeneration(Globals & globals, int dstGen)
|
static void switchGeneration(Globals & globals, int dstGen)
|
||||||
{
|
{
|
||||||
|
PathLocks lock;
|
||||||
|
lockProfile(lock, globals.profile);
|
||||||
|
|
||||||
int curGen;
|
int curGen;
|
||||||
Generations gens = findGenerations(globals.profile, curGen);
|
Generations gens = findGenerations(globals.profile, curGen);
|
||||||
|
|
||||||
|
@ -1004,6 +1007,9 @@ static void opListGenerations(Globals & globals,
|
||||||
if (opArgs.size() != 0)
|
if (opArgs.size() != 0)
|
||||||
throw UsageError(format("no arguments expected"));
|
throw UsageError(format("no arguments expected"));
|
||||||
|
|
||||||
|
PathLocks lock;
|
||||||
|
lockProfile(lock, globals.profile);
|
||||||
|
|
||||||
int curGen;
|
int curGen;
|
||||||
Generations gens = findGenerations(globals.profile, curGen);
|
Generations gens = findGenerations(globals.profile, curGen);
|
||||||
|
|
||||||
|
@ -1032,6 +1038,9 @@ static void opDeleteGenerations(Globals & globals,
|
||||||
if (opFlags.size() > 0)
|
if (opFlags.size() > 0)
|
||||||
throw UsageError(format("unknown flag `%1%'") % opFlags.front());
|
throw UsageError(format("unknown flag `%1%'") % opFlags.front());
|
||||||
|
|
||||||
|
PathLocks lock;
|
||||||
|
lockProfile(lock, globals.profile);
|
||||||
|
|
||||||
int curGen;
|
int curGen;
|
||||||
Generations gens = findGenerations(globals.profile, curGen);
|
Generations gens = findGenerations(globals.profile, curGen);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue