libexpr: Migrate EvalPaths::allowAndSetStorePathString to return a Value

Part of #1136

Change-Id: Icf16109a63f1b8114e0af9db0a9213c46a6a6964
This commit is contained in:
skye
2026-04-07 22:35:12 -04:00
parent cbeb4fcd69
commit 86126d6c89
4 changed files with 8 additions and 8 deletions
+2 -2
View File
@@ -434,11 +434,11 @@ void EvalPaths::allowPath(const StorePath & storePath)
allowPath(store->toRealPath(storePath));
}
void EvalPaths::allowAndSetStorePathString(const StorePath & storePath, Value & v)
Value EvalPaths::allowAndSetStorePathString(const StorePath & storePath)
{
allowPath(storePath);
v = mkStorePathString(storePath);
return mkStorePathString(storePath);
}
CheckedSourcePath EvalPaths::checkSourcePath(const SourcePath & path_)
+1 -1
View File
@@ -370,7 +370,7 @@ public:
/**
* Allow access to a store path and return it as a string.
*/
void allowAndSetStorePathString(const StorePath & storePath, Value & v);
Value allowAndSetStorePathString(const StorePath & storePath);
/**
* Check whether access to a path is allowed and throw an error if
+3 -3
View File
@@ -1659,7 +1659,7 @@ static void prim_toFile(EvalState & state, Value * * args, Value & v)
used in args[1]. */
/* Add the output of this to the allowed paths. */
state.ctx.paths.allowAndSetStorePathString(storePath, v);
v = state.ctx.paths.allowAndSetStorePathString(storePath);
}
static void addPath(
@@ -1746,9 +1746,9 @@ static void addPath(
"store path mismatch in (possibly filtered) path added from '%s'",
path
).debugThrow();
state.ctx.paths.allowAndSetStorePathString(dstPath, v);
v = state.ctx.paths.allowAndSetStorePathString(dstPath);
} else
state.ctx.paths.allowAndSetStorePathString(*expectedStorePath, v);
v = state.ctx.paths.allowAndSetStorePathString(*expectedStorePath);
} catch (Error & e) {
e.addTrace(nullptr, "while adding path '%s'", path);
throw;
+2 -2
View File
@@ -299,7 +299,7 @@ static void fetch(EvalState & state, const PosIdx pos, Value * * args, Value & v
});
if (state.aio.blockOn(state.ctx.store->isValidPath(expectedPath))) {
state.ctx.paths.allowAndSetStorePathString(expectedPath, v);
v = state.ctx.paths.allowAndSetStorePathString(expectedPath);
return;
}
}
@@ -331,7 +331,7 @@ static void fetch(EvalState & state, const PosIdx pos, Value * * args, Value & v
}
}
state.ctx.paths.allowAndSetStorePathString(storePath, v);
v = state.ctx.paths.allowAndSetStorePathString(storePath);
}
void prim_fetchurl(EvalState & state, Value * * args, Value & v)