libexpr: Migrate EvalPaths::allowAndSetStorePathString to return a Value
Part of #1136 Change-Id: Icf16109a63f1b8114e0af9db0a9213c46a6a6964
This commit is contained in:
+2
-2
@@ -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
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user