Fix reading the lockfile of a flake in a subdirectory

This commit is contained in:
Eelco Dolstra 2019-05-31 20:12:59 +02:00
parent 9169046e64
commit 7adb10d29b
No known key found for this signature in database
GPG key ID: 8170B4726D7198DE

View file

@ -482,9 +482,12 @@ ResolvedFlake resolveFlake(EvalState & state, const FlakeRef & topRef, HandleLoc
Flake flake = getFlake(state, topRef, allowedToUseRegistries(handleLockFile, true)); Flake flake = getFlake(state, topRef, allowedToUseRegistries(handleLockFile, true));
LockFile oldLockFile; LockFile oldLockFile;
if (!recreateLockFile (handleLockFile)) { if (!recreateLockFile(handleLockFile)) {
// If recreateLockFile, start with an empty lockfile // If recreateLockFile, start with an empty lockfile
oldLockFile = readLockFile(flake.sourceInfo.storePath + "/flake.lock"); // FIXME: symlink attack // FIXME: symlink attack
oldLockFile = readLockFile(
state.store->toRealPath(flake.sourceInfo.storePath)
+ "/" + flake.sourceInfo.resolvedRef.subdir + "/flake.lock");
} }
LockFile lockFile(oldLockFile); LockFile lockFile(oldLockFile);