mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-22 22:16:16 +02:00
Allow builtins.{readFile,path} on invalid paths
Stop-gap measure to fix #5975.
This commit is contained in:
parent
e66550c917
commit
8cbbaf23e8
1 changed files with 14 additions and 7 deletions
|
@ -1445,9 +1445,13 @@ static void prim_readFile(EvalState & state, const Pos & pos, Value * * args, Va
|
||||||
string s = readFile(path);
|
string s = readFile(path);
|
||||||
if (s.find((char) 0) != string::npos)
|
if (s.find((char) 0) != string::npos)
|
||||||
throw Error("the contents of the file '%1%' cannot be represented as a Nix string", path);
|
throw Error("the contents of the file '%1%' cannot be represented as a Nix string", path);
|
||||||
auto refs = state.store->isInStore(path) ?
|
StorePathSet refs;
|
||||||
state.store->queryPathInfo(state.store->toStorePath(path).first)->references :
|
if (state.store->isInStore(path)) {
|
||||||
StorePathSet{};
|
try {
|
||||||
|
refs = state.store->queryPathInfo(state.store->toStorePath(path).first)->references;
|
||||||
|
} catch (Error &) { // FIXME: should be InvalidPathError
|
||||||
|
}
|
||||||
|
}
|
||||||
auto context = state.store->printStorePathSet(refs);
|
auto context = state.store->printStorePathSet(refs);
|
||||||
v.mkString(s, context);
|
v.mkString(s, context);
|
||||||
}
|
}
|
||||||
|
@ -1866,10 +1870,13 @@ static void addPath(
|
||||||
StorePathSet refs;
|
StorePathSet refs;
|
||||||
|
|
||||||
if (state.store->isInStore(path)) {
|
if (state.store->isInStore(path)) {
|
||||||
auto [storePath, subPath] = state.store->toStorePath(path);
|
try {
|
||||||
// FIXME: we should scanForReferences on the path before adding it
|
auto [storePath, subPath] = state.store->toStorePath(path);
|
||||||
refs = state.store->queryPathInfo(storePath)->references;
|
// FIXME: we should scanForReferences on the path before adding it
|
||||||
path = state.store->toRealPath(storePath) + subPath;
|
refs = state.store->queryPathInfo(storePath)->references;
|
||||||
|
path = state.store->toRealPath(storePath) + subPath;
|
||||||
|
} catch (Error &) { // FIXME: should be InvalidPathError
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
path = evalSettings.pureEval && expectedHash
|
path = evalSettings.pureEval && expectedHash
|
||||||
|
|
Loading…
Reference in a new issue